Skip to content

Commit

Permalink
Fix plugins not being removed when mods are deleted
Browse files Browse the repository at this point in the history
Fix a recently introduced bug where deleting a mod that contains plugins
didn't remove those plugins. The delete command doesn't need to run
self.refresh() if we manually keep the plugins list in sync. Upon
removing a line that deactivated the mod before deleting it, we lost the
logic that removed plugins upon deletion.
  • Loading branch information
cyberrumor committed Mar 31, 2024
1 parent 09ce66f commit 78b32eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ammo/mod_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,11 @@ def delete(self, component: DeleteEnum, index: Union[int, str]) -> None:
"You can only delete all visible components if they are all deactivated."
)
for mod in visible_mods:
self.mods.pop(self.mods.index(mod))
# Remove plugins that mod provides.
self._set_component_state(
ComponentEnum.MOD, self.mods.index(mod), False
)
self.mods.remove(mod)
try:
shutil.rmtree(mod.location)
except FileNotFoundError:
Expand All @@ -761,6 +765,9 @@ def delete(self, component: DeleteEnum, index: Union[int, str]) -> None:
raise Warning("You can only delete visible components.")

# Remove the mod from the controller then delete it.
self._set_component_state(
ComponentEnum.MOD, self.mods.index(mod), False
)
self.mods.pop(index)
try:
shutil.rmtree(mod.location)
Expand Down

0 comments on commit 78b32eb

Please sign in to comment.