From 859fc326176670e4e5efb1ba27898bd99772dd81 Mon Sep 17 00:00:00 2001 From: reloxx13 Date: Fri, 9 Dec 2022 08:59:56 +0100 Subject: [PATCH] autopatch: Re-use downloaded driver in temp This will re-use a downloaded driver in temp to avoid 2nd download for 32bit and 64bit patching --- win/tools/autopatch/autopatch.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/win/tools/autopatch/autopatch.py b/win/tools/autopatch/autopatch.py index a214cb6..6542b0a 100755 --- a/win/tools/autopatch/autopatch.py +++ b/win/tools/autopatch/autopatch.py @@ -203,10 +203,16 @@ def patch_flow(installer_file, search, replacement, target, target_name, patch_n else: # installer_file is an url filename = os.path.basename(installer_file) # download installer and save in .temp - print(f"Downloading... ( {installer_file} TO {os.path.join('temp', filename)} )") - print("This may take a while (~800MB)") - urllib.request.urlretrieve(installer_file, os.path.join('temp', filename)) - installer_file = os.path.join('temp', filename) + + if not os.path.isfile(os.path.join('temp', filename)): # check if file already downloaded + print(f"Downloading... ( {installer_file} TO {os.path.join('temp', filename)} )") + print("This may take a while (~800MB)") + urllib.request.urlretrieve(installer_file, os.path.join('temp', filename)) + installer_file = os.path.join('temp', filename) + else: + installer_file = os.path.join('temp', filename) + print(f"Use downloaded file in `{installer_file}`") + patch = make_patch(installer_file,