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))