From 1830081cb049a41633c23a872f92b9f6a1485a1d Mon Sep 17 00:00:00 2001 From: tretrauit Date: Wed, 28 Sep 2022 21:19:20 +0700 Subject: [PATCH] fix: use 7z to extract game file --- setup.py | 2 +- worthless/installer.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 611ac50..7046199 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text() setup( name='worthless', - version='2.2.3', + version='2.2.4', packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'], url='https://git.froggi.es/tretrauit/worthless-launcher', license='MIT License', diff --git a/worthless/installer.py b/worthless/installer.py index cc1875c..57c5cbf 100644 --- a/worthless/installer.py +++ b/worthless/installer.py @@ -413,8 +413,13 @@ class Installer: archive = Path(archive).resolve() if not archive.exists(): raise FileNotFoundError(f"'{archive}' not found") - with zipfile.ZipFile(archive, 'r') as f: - await asyncio.to_thread(f.extractall, path=self._gamedir) + print(f'-o"{str(self._gamedir)}"') + proc = await asyncio.create_subprocess_shell(f"7z x {str(archive)} -o'{str(self._gamedir)}'") + await proc.wait() + if proc.returncode != 0: + raise RuntimeError("Extracting failed") + # with zipfile.ZipFile(archive, 'r') as f: + # await asyncio.to_thread(f.extractall, path=self._gamedir) async def apply_voiceover(self, voiceover_archive: str | Path): # Since Voiceover packages are unclear about diff package or full package