updater: change the returncode check

Signed-off-by: tretrauit <tretrauit@gmail.com>
This commit is contained in:
tretrauit 2022-12-07 13:04:48 +07:00
parent 98898827e9
commit 178f513e52
Signed by: tretrauit
GPG Key ID: CDDE1C97EE305DAF
1 changed files with 7 additions and 7 deletions

View File

@ -374,14 +374,14 @@ class Installer:
proc = await self._hdiffpatch.patch_file(old_file, old_file.with_suffix(old_suffix),
patch_path, wait=True)
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))
if proc.returncode == 0:
await old_file.unlink()
return
await old_file.unlink()
# 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))
files.remove(patch_file)
patch_jobs.append(extract_and_patch(current_game_file, patch_file))