From 178f513e526ff17d98f5590afa2abe85885e0f64 Mon Sep 17 00:00:00 2001 From: tretrauit Date: Wed, 7 Dec 2022 13:04:48 +0700 Subject: [PATCH] updater: change the returncode check Signed-off-by: tretrauit --- worthless/installer.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/worthless/installer.py b/worthless/installer.py index f2c9ed4..3d46329 100644 --- a/worthless/installer.py +++ b/worthless/installer.py @@ -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))