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
No known key found for this signature in database
GPG Key ID: CDDE1C97EE305DAF

View File

@ -374,14 +374,14 @@ class Installer:
proc = await self._hdiffpatch.patch_file(old_file, old_file.with_suffix(old_suffix), proc = await self._hdiffpatch.patch_file(old_file, old_file.with_suffix(old_suffix),
patch_path, wait=True) patch_path, wait=True)
patch_path.unlink() patch_path.unlink()
if proc.returncode != 0: if proc.returncode == 0:
await old_file.unlink()
return
# Let the game download the file. # Let the game download the file.
print("Failed to patch {}, reverting and let the in-game updater do the job...".format( print("Failed to patch {}, reverting and let the in-game updater do the job...".format(
old_file.with_suffix(old_suffix)) old_file.with_suffix(old_suffix))
) )
await old_file.rename(old_file.with_suffix(old_suffix)) await old_file.rename(old_file.with_suffix(old_suffix))
return
await old_file.unlink()
files.remove(patch_file) files.remove(patch_file)
patch_jobs.append(extract_and_patch(current_game_file, patch_file)) patch_jobs.append(extract_and_patch(current_game_file, patch_file))