fix: use 7z to extract game file

This commit is contained in:
tretrauit 2022-09-28 21:19:20 +07:00
parent f54c2f432b
commit 1830081cb0
Signed by: tretrauit
GPG Key ID: CDDE1C97EE305DAF
2 changed files with 8 additions and 3 deletions

View File

@ -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',

View File

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