Add settings cleanup to Auto-Generate Groups.

This commit is contained in:
Ottermandias 2021-11-16 16:05:58 +01:00
parent cd74a41453
commit 88a1e9f2ae
2 changed files with 12 additions and 3 deletions

View file

@ -519,6 +519,10 @@ namespace Penumbra.Mod
meta.Groups.Add( groupDir.Name, @group ); meta.Groups.Add( groupDir.Name, @group );
} }
} }
foreach(var collection in Service<ModManager>.Get().Collections.Collections.Values)
collection.UpdateSetting(baseDir, meta, true);
} }
} }
} }

View file

@ -96,19 +96,24 @@ namespace Penumbra.Mods
public void ClearCache() public void ClearCache()
=> Cache = null; => Cache = null;
public void UpdateSetting( ModData mod ) public void UpdateSetting( DirectoryInfo modPath, ModMeta meta, bool clear )
{ {
if( !Settings.TryGetValue( mod.BasePath.Name, out var settings ) ) if( !Settings.TryGetValue( modPath.Name, out var settings ) )
{ {
return; return;
} }
if( settings.FixInvalidSettings( mod.Meta ) ) if (clear)
settings.Settings.Clear();
if( settings.FixInvalidSettings( meta ) )
{ {
Save(); Save();
} }
} }
public void UpdateSetting( ModData mod )
=> UpdateSetting( mod.BasePath, mod.Meta, false );
public void UpdateSettings( bool forceSave ) public void UpdateSettings( bool forceSave )
{ {
if( Cache == null ) if( Cache == null )