Merge pull request #593 from reloxx13/feature/re-use_already_downloaded_driver

[FR] WinTool: Re-use a downloaded driver in temp
This commit is contained in:
Jai Luthra 2022-12-10 20:57:26 +05:30 committed by GitHub
commit 5a4b9c749b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -203,10 +203,16 @@ def patch_flow(installer_file, search, replacement, target, target_name, patch_n
else: # installer_file is an url else: # installer_file is an url
filename = os.path.basename(installer_file) filename = os.path.basename(installer_file)
# download installer and save in .temp # download installer and save in .temp
print(f"Downloading... ( {installer_file} TO {os.path.join('temp', filename)} )")
print("This may take a while (~800MB)") if not os.path.isfile(os.path.join('temp', filename)): # check if file already downloaded
urllib.request.urlretrieve(installer_file, os.path.join('temp', filename)) print(f"Downloading... ( {installer_file} TO {os.path.join('temp', filename)} )")
installer_file = 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, patch = make_patch(installer_file,