Skip to content

Extract mod uninstallation logic from GenericProfileInstaller#2104

Merged
anttimaki merged 5 commits intodevelopfrom
IRPI-03
Apr 8, 2026
Merged

Extract mod uninstallation logic from GenericProfileInstaller#2104
anttimaki merged 5 commits intodevelopfrom
IRPI-03

Conversation

@anttimaki
Copy link
Copy Markdown
Collaborator

No description provided.

This is a step on the path to make InstallRulePluginInstaller support
all four methods of PackageInstaller class.

I'm not sure if it matters in which order uninstallState and
uninstallModLoader is called but decide to keep the order unchanged.

Likewise uninstallModLoader behaves the same way it used to, i.e.
even if mod loader files are uninstalled, the rest of the non-loader
mod uninstallation code is still executed.
Some extra logic is still left in GenericProfileInstaller - these can
be cleaned out once getPluginInstaller starts returning IRPI as the
installer for the games that currently fall back to legacy
implementation that's embedded into GenericProfileInstaller.
Both ReturnOfModdingInstaller and ReturnOfModdingPluginInstaller have
independent implementations for uninstalling and related packages never
call uninstallSubDir.
Mainly rename the variable that refers to BepInEx when other mod
loaders also use this code path.
Import it into package loader installers that don't have a custom
implementation. Now all package loader installers implement uninstall,
but this doesn't apply to plugin installers yet.

It's worth noting that this duplicates the implementation, as the
package loader uninstall logic is still kept in GenericProfileInstaller
too, since the version extracted to PackageInstaller handles errors
slightly differently. The verison in GenericProfileInstaller will be
removed later as the refactoring process progresses.
@anttimaki anttimaki requested a review from ebkr March 30, 2026 09:12
Comment on lines +151 to +154
// Fallback to legacy uninstallation.
throwForR2Error(await this.uninstallModLoader(mod, profile));
const args = this.getInstallArgs(mod, profile);
await this.legacyInstaller.uninstall(args);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we not cover with these changes? Why the need for the fallback?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a move-code-around refactoring commit, so to keep the mod manager behaving like it did before the commit, I don't remove the legacy fallback here. (TBH I don't remember if there's actually some use cases that actually still hit this code path at this point.) It will be removed in an upcoming PR once all the logic has been moved from GenericProfileInstaller to PackageInstaller implementations.

Base automatically changed from IRPI-02 to develop April 8, 2026 07:37
@anttimaki anttimaki merged commit 8889bd6 into develop Apr 8, 2026
6 checks passed
@anttimaki anttimaki deleted the IRPI-03 branch April 8, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants