updater: more logs

Signed-off-by: tretrauit <tretrauit@gmail.com>
This commit is contained in:
tretrauit 2022-12-07 13:03:19 +07:00
parent 95f21e6d2a
commit 98898827e9
Signed by: tretrauit
GPG Key ID: CDDE1C97EE305DAF
1 changed files with 5 additions and 4 deletions

View File

@ -361,16 +361,14 @@ class Installer:
patch_file = str(file) + ".hdiff"
async def extract_and_patch(old_file, diff_file):
diff_path = self.temp_path.joinpath(diff_file)
if diff_path.is_file():
diff_path.unlink(missing_ok=True)
patch_path = self.temp_path.joinpath(diff_file)
patch_path.unlink(missing_ok=True)
try:
print(diff_file)
await asyncio.to_thread(archive.extract, diff_file, self.temp_path)
except FileExistsError:
print("Failed to extract diff file", diff_file)
return
patch_path = self.temp_path.joinpath(diff_file)
old_suffix = old_file.suffix
old_file = await old_file.rename(old_file.with_suffix(".bak"))
proc = await self._hdiffpatch.patch_file(old_file, old_file.with_suffix(old_suffix),
@ -378,6 +376,9 @@ class Installer:
patch_path.unlink()
if proc.returncode != 0:
# Let the game download the file.
print("Failed to patch {}, reverting and let the in-game updater do the job...".format(
old_file.with_suffix(old_suffix))
)
await old_file.rename(old_file.with_suffix(old_suffix))
return
await old_file.unlink()