mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Fix a problem when incorporating deduplicated meta files simultaneously over multiple options.
This commit is contained in:
parent
1268344d04
commit
20e6baee0b
2 changed files with 23 additions and 5 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
|
|
@ -80,12 +81,20 @@ public partial class Mod
|
|||
// Deletes the source files if delete is true.
|
||||
private void IncorporateAllMetaChanges( bool delete )
|
||||
{
|
||||
var changes = false;
|
||||
var changes = false;
|
||||
List< string > deleteList = new();
|
||||
foreach( var subMod in AllSubMods.OfType< SubMod >() )
|
||||
{
|
||||
changes |= subMod.IncorporateMetaChanges( ModPath, delete );
|
||||
var (localChanges, localDeleteList) = subMod.IncorporateMetaChanges( ModPath, false );
|
||||
changes |= localChanges;
|
||||
if( delete )
|
||||
{
|
||||
deleteList.AddRange( localDeleteList );
|
||||
}
|
||||
}
|
||||
|
||||
SubMod.DeleteDeleteList( deleteList, delete );
|
||||
|
||||
if( changes )
|
||||
{
|
||||
SaveAllGroups();
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public partial class Mod
|
|||
|
||||
// If .meta or .rgsp files are encountered, parse them and incorporate their meta changes into the mod.
|
||||
// If delete is true, the files are deleted afterwards.
|
||||
public bool IncorporateMetaChanges( DirectoryInfo basePath, bool delete )
|
||||
public (bool Changes, List< string > DeleteList) IncorporateMetaChanges( DirectoryInfo basePath, bool delete )
|
||||
{
|
||||
var deleteList = new List< string >();
|
||||
var oldSize = ManipulationData.Count;
|
||||
|
|
@ -227,6 +227,17 @@ public partial class Mod
|
|||
}
|
||||
}
|
||||
|
||||
DeleteDeleteList( deleteList, delete );
|
||||
return ( oldSize < ManipulationData.Count, deleteList );
|
||||
}
|
||||
|
||||
internal static void DeleteDeleteList( IEnumerable< string > deleteList, bool delete )
|
||||
{
|
||||
if( !delete )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach( var file in deleteList )
|
||||
{
|
||||
try
|
||||
|
|
@ -238,8 +249,6 @@ public partial class Mod
|
|||
Penumbra.Log.Error( $"Could not delete incorporated meta file {file}:\n{e}" );
|
||||
}
|
||||
}
|
||||
|
||||
return oldSize < ManipulationData.Count;
|
||||
}
|
||||
|
||||
public void WriteTexToolsMeta( DirectoryInfo basePath, bool test = false )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue