diff --git a/Penumbra/Collections/CollectionManager.cs b/Penumbra/Collections/CollectionManager.cs index 36bb2599..b222d445 100644 --- a/Penumbra/Collections/CollectionManager.cs +++ b/Penumbra/Collections/CollectionManager.cs @@ -68,7 +68,7 @@ public partial class ModCollection _modManager.ModDiscoveryStarted += OnModDiscoveryStarted; _modManager.ModDiscoveryFinished += OnModDiscoveryFinished; _modManager.ModOptionChanged += OnModOptionsChanged; - _modManager.ModPathChanged += OnModPathChanged; + _modManager.ModPathChanged += OnModPathChange; CollectionChanged += SaveOnChange; ReadCollections(); LoadCollections(); @@ -79,7 +79,7 @@ public partial class ModCollection _modManager.ModDiscoveryStarted -= OnModDiscoveryStarted; _modManager.ModDiscoveryFinished -= OnModDiscoveryFinished; _modManager.ModOptionChanged -= OnModOptionsChanged; - _modManager.ModPathChanged -= OnModPathChanged; + _modManager.ModPathChanged -= OnModPathChange; } // Returns true if the name is not empty, it is not the name of the empty collection @@ -210,7 +210,7 @@ public partial class ModCollection // A changed mod path forces changes for all collections, active and inactive. - private void OnModPathChanged( ModPathChangeType type, Mod mod, DirectoryInfo? oldDirectory, + private void OnModPathChange( ModPathChangeType type, Mod mod, DirectoryInfo? oldDirectory, DirectoryInfo? newDirectory ) { switch( type ) diff --git a/Penumbra/Mods/Manager/Mod.Manager.BasePath.cs b/Penumbra/Mods/Manager/Mod.Manager.BasePath.cs index abb28f0a..e9a2d104 100644 --- a/Penumbra/Mods/Manager/Mod.Manager.BasePath.cs +++ b/Penumbra/Mods/Manager/Mod.Manager.BasePath.cs @@ -99,7 +99,7 @@ public partial class Mod } } - // Delete a mod by its index. + // Delete a mod by its index. The event is invoked before the mod is removed from the list. // Deletes from filesystem as well as from internal data. // Updates indices of later mods. public void DeleteMod( int idx ) @@ -118,13 +118,13 @@ public partial class Mod } } + ModPathChanged.Invoke( ModPathChangeType.Deleted, mod, mod.ModPath, null ); _mods.RemoveAt( idx ); foreach( var remainingMod in _mods.Skip( idx ) ) { --remainingMod.Index; } - ModPathChanged.Invoke( ModPathChangeType.Deleted, mod, mod.ModPath, null ); PluginLog.Debug( "Deleted mod {Name:l}.", mod.Name ); }