fix: actually delete files in deletefiles.txt

This commit is contained in:
tretrauit 2023-05-25 13:01:04 +07:00
parent aa4fe4d5ed
commit 973ae2a5e6
5 changed files with 9 additions and 6 deletions

View File

@ -10,7 +10,7 @@ README = (HERE / "README.md").read_text()
setup( setup(
name='worthless', name='worthless',
version='2.2.19', version='2.2.20',
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',

View File

@ -4,4 +4,4 @@ Launcher = launcher.Launcher
Installer = installer.Installer Installer = installer.Installer
__version__ = "2.2.19" __version__ = "2.2.20"

0
worthless/__main__.py Executable file → Normal file
View File

0
worthless/cli.py Executable file → Normal file
View File

View File

@ -404,12 +404,15 @@ class Installer:
print(f"Error while reading hdifffiles.txt: {e}") print(f"Error while reading hdifffiles.txt: {e}")
try: try:
deletefiles = archive.read("deletefiles.txt").decode().split("\n") deletefiles = archive.read("deletefiles.txt").decode().split("\r\n")
for file in deletefiles: for file in deletefiles:
current_game_file = Path(self._gamedir.joinpath(file)) current_game_file = Path(self._gamedir).joinpath(file)
if current_game_file == Path(self._gamedir): if current_game_file == Path(self._gamedir):
# Don't delete the game folder
print("Game folder detected, not deleting:", current_game_file)
continue continue
if not current_game_file.is_file(): if not current_game_file.relative_to(Path(self._gamedir)):
print("Not deleting (not relative to game):", current_game_file)
continue continue
print("Deleting", file) print("Deleting", file)
current_game_file.unlink(missing_ok=True) current_game_file.unlink(missing_ok=True)