From 0b51be1649a9b1bc7dbee7492bbc754593a130f5 Mon Sep 17 00:00:00 2001 From: tretrauit Date: Wed, 2 Nov 2022 12:26:37 +0700 Subject: [PATCH] updater: remove directory in deletefiles.txt too --- setup.py | 2 +- worthless/installer.py | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 6f183e2..c6ac3df 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text() setup( name='worthless', - version='2.2.5', + version='2.2.6', 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 105bd18..95abbae 100644 --- a/worthless/installer.py +++ b/worthless/installer.py @@ -391,6 +391,9 @@ class Installer: continue if current_game_file.is_file(): current_game_file.unlink(missing_ok=True) + continue + if current_game_file.is_dir(): + shutil.rmtree(current_game_file, ignore_errors=True) await asyncio.to_thread(archive.extractall, self._gamedir, members=files) archive.close() @@ -426,14 +429,6 @@ class Installer: archive = Path(archive).resolve() if not archive.exists(): raise FileNotFoundError(f"'{archive}' not found") - # game_dir_str = str(self._gamedir) - # if not game_dir_str.endswith("/"): - # game_dir_str += "/" - # print(f'-o"{game_dir_str}"') - # proc = await asyncio.create_subprocess_shell(f'7z x {str(archive)} -o"{game_dir_str}"') - # 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)