Improve handling of unregistered files at uninstall #3890
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
#3886 reports that, despite #2962, some users are still leaving mostly-empty game folders in place after uninstalling the corresponding mod, which breaks ModuleManager patches that use
:NEEDS[dirname]
and expect the mod to be installed in the folder.Causes
@thumbs
directories inside directories with names ending inParts
(case sensitive, soparts
doesn't get one butPorkjetParts
does), which are a cache of images to be used as thumbnail images for parts, and which users may not recognize or understand as deletion-worthy.(Note that some mods choose to include these folders in their download ZIPs to save them being recreated on users' PCs in-game; in these cases, CKAN would already be deleting them at uninstall anyway.)
Changes
Updates to module uninstallation:
IGame.AutoRemovableDirs
:@thumbs
and could have others added in the future. To avoid ever deleting something the user wanted to keep, it's important to ensure that it's known to be auto-generated and otherwise not of interest to user manipulation, and@thumbs
clears that bar.This will allow the Delete Directories tab to be skipped safely in many instances where it appears today, with outcomes the same or better than they otherwise would have been.
Updates to the Delete Directories tab:
StringHeight
functions are now refactored into theUtil
classThis should help users to end up with clean, functional installs without risk of silently deleting important files that they wanted to keep.
In addition:
Fixes #3886.