fix: actually delete files in deletefiles.txt
This commit is contained in:
@ -404,14 +404,17 @@ class Installer:
|
||||
print(f"Error while reading hdifffiles.txt: {e}")
|
||||
|
||||
try:
|
||||
deletefiles = archive.read("deletefiles.txt").decode().split("\n")
|
||||
deletefiles = archive.read("deletefiles.txt").decode().split("\r\n")
|
||||
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):
|
||||
# Don't delete the game folder
|
||||
print("Game folder detected, not deleting:", current_game_file)
|
||||
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
|
||||
print("Deleting ", file)
|
||||
print("Deleting", file)
|
||||
current_game_file.unlink(missing_ok=True)
|
||||
except Exception as e:
|
||||
print(f"Error while reading deletefiles.txt: {e}")
|
||||
|
||||
Reference in New Issue
Block a user