[Vortex extension] uninstall generated files
Pathoschild opened this issue ยท 2 comments
When Vortex uninstalls a mod, it only removes the files that were originally installed. This leaves the folder behind with any generated files like config.json
, causing 'missing manifest' errors in SMAPI.
For background, Vortex installs mods by storing the original mod archive, unzipping the mod into an internal folder (not visible to the game), and symlinking the files into the game folder. To uninstall the mod, it just removes the symlinks.
Per discussion with Tannin, the best way to handle generated files is to move them into that internal folder when the mod is disabled. That way they'll get removed automatically, and symlinked back in when the mod is re-enabled.
Notes from that discussion:
- Vortex raises a
mods-enabled
event when mods are enabled/disabled, with two parameters: a list of affected mod IDs, and whether they were enabled (true) or disabled (false). - For example, the
mod-dependency-management
extension reacts to that event. - We can look at
state.persistent.mods[gameId][modId].installationPath
to get the mod's internal folder path. That's relative to the base install path, which can be accessed viaselectors.installPath(state)
.