updater: remove directory in deletefiles.txt too

This commit is contained in:
tretrauit 2022-11-02 12:26:37 +07:00
parent abdf19bc16
commit 0b51be1649
No known key found for this signature in database
GPG Key ID: CDDE1C97EE305DAF
2 changed files with 4 additions and 9 deletions

View File

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

View File

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