Skip to content

Commit

Permalink
fix: Do not break uninstall when file is missing (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
m3e-g authored Jan 27, 2024
1 parent 731d653 commit f4eca37
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nile/utils/uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ def uninstall(self):
# Load manifest
self.manifest = self.load_installed_manifest(game_id)

files = self.manifest.packages[0].files
for f in files:
for f in self.manifest.packages[0].files:
# Manifest can contain both kind of slash as a separator on the same entry
os.remove(os.path.join(installed_info["path"], f.path.replace("\\", os.sep).replace("/", os.sep)))
filepath = os.path.join(installed_info["path"], f.path.replace("\\", os.sep).replace("/", os.sep))
try:
os.remove(filepath)
except FileNotFoundError:
self.logger.warning(f'Missing file "{filepath}" - skipping')

# Remove empty directories under the installation directory
for dirpath, dirnames, filenames in os.walk(installed_info["path"], topdown=False):
Expand Down

0 comments on commit f4eca37

Please sign in to comment.