Remove game version check in download_full_game()

Fix remote archive name detection (because archive.game.latest.name doesn't contain it anymore)

Signed-off-by: tretrauit <tretrauit@gmail.com>
This commit is contained in:
tretrauit 2022-04-01 09:43:33 +07:00
parent b18da4e495
commit 8b2d0cad8f
Signed by: tretrauit
GPG Key ID: 862760FF1903319E
2 changed files with 13 additions and 6 deletions

View File

@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text()
setup(
name='worthless',
version='1.3.1-1',
version='1.3.1-2',
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
url='https://git.froggi.es/tretrauit/worthless-launcher',
license='MIT License',

View File

@ -98,11 +98,15 @@ class HDiffPatch:
hpatchz_name = "hpatchz" + (".exe" if platform.system() == "Windows" else "")
return self._get_hdiffpatch_exec(hpatchz_name)
async def patch_file(self, in_file, out_file, patch_file):
async def patch_file(self, in_file, out_file, patch_file, wait=False):
hpatchz = self.get_hpatchz_executable()
if not hpatchz:
raise RuntimeError("hpatchz executable not found")
return await asyncio.create_subprocess_exec(hpatchz, "-f", in_file, patch_file, out_file)
proc = await asyncio.create_subprocess_exec(hpatchz, "-f", in_file, patch_file, out_file)
if not wait:
return proc
await proc.wait()
return proc
def get_hdiffz_executable(self):
hdiffz_name = "hdiffz" + (".exe" if platform.system() == "Windows" else "")
@ -334,13 +338,16 @@ class Installer:
old_suffix = old_file.suffix
old_file = old_file.rename(old_file.with_suffix(".bak"))
proc = await self._hdiffpatch.patch_file(old_file, old_file.with_suffix(old_suffix),
patch_path)
await proc.wait()
patch_path, wait=True)
patch_path.unlink()
if proc.returncode != 0:
# Let the game redownload the file.
old_file.rename(old_file.with_suffix(old_suffix))
return
old_file.unlink()
files.remove(patch_file)
patch_jobs.append(extract_and_patch(current_game_file, patch_file))
await asyncio.gather(*patch_jobs)
deletefiles = archive.read("deletefiles.txt").decode().split("\n")