[core] Only delete files that are actually installed (based on tags)

This commit is contained in:
derrod 2021-10-12 15:24:49 +02:00
parent 07ae84c6a0
commit e6bb64f16f

View file

@ -1181,7 +1181,10 @@ class LegendaryCore:
if delete_files:
try:
manifest = self.load_manifest(self.get_installed_manifest(installed_game.app_name)[0])
filelist = [fm.filename for fm in manifest.file_manifest_list.elements]
filelist = [
fm.filename for fm in manifest.file_manifest_list.elements if
not fm.install_tags or any(t in installed_game.install_tags for t in fm.install_tags)
]
if not delete_filelist(installed_game.install_path, filelist, delete_root_directory):
self.log.error(f'Deleting "{installed_game.install_path}" failed, please remove manually.')
except Exception as e: