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:
parent
b18da4e495
commit
8b2d0cad8f
2
setup.py
2
setup.py
@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text()
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='worthless',
|
name='worthless',
|
||||||
version='1.3.1-1',
|
version='1.3.1-2',
|
||||||
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
|
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
|
||||||
url='https://git.froggi.es/tretrauit/worthless-launcher',
|
url='https://git.froggi.es/tretrauit/worthless-launcher',
|
||||||
license='MIT License',
|
license='MIT License',
|
||||||
|
@ -98,11 +98,15 @@ class HDiffPatch:
|
|||||||
hpatchz_name = "hpatchz" + (".exe" if platform.system() == "Windows" else "")
|
hpatchz_name = "hpatchz" + (".exe" if platform.system() == "Windows" else "")
|
||||||
return self._get_hdiffpatch_exec(hpatchz_name)
|
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()
|
hpatchz = self.get_hpatchz_executable()
|
||||||
if not hpatchz:
|
if not hpatchz:
|
||||||
raise RuntimeError("hpatchz executable not found")
|
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):
|
def get_hdiffz_executable(self):
|
||||||
hdiffz_name = "hdiffz" + (".exe" if platform.system() == "Windows" else "")
|
hdiffz_name = "hdiffz" + (".exe" if platform.system() == "Windows" else "")
|
||||||
@ -334,13 +338,16 @@ class Installer:
|
|||||||
old_suffix = old_file.suffix
|
old_suffix = old_file.suffix
|
||||||
old_file = old_file.rename(old_file.with_suffix(".bak"))
|
old_file = old_file.rename(old_file.with_suffix(".bak"))
|
||||||
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)
|
patch_path, wait=True)
|
||||||
await proc.wait()
|
|
||||||
patch_path.unlink()
|
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()
|
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))
|
||||||
|
|
||||||
await asyncio.gather(*patch_jobs)
|
await asyncio.gather(*patch_jobs)
|
||||||
|
|
||||||
deletefiles = archive.read("deletefiles.txt").decode().split("\n")
|
deletefiles = archive.read("deletefiles.txt").decode().split("\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user