Skip to content

Commit abc1bff

Browse files
committed
Fixed root cloner deleting mod files too aggressively from other slots.
1 parent d093717 commit abc1bff

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

xivModdingFramework/Mods/RootCloner.cs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
136136
var iCat = destItem.SecondaryCategory;
137137
var iName = destItem.Name;
138138

139+
140+
var files = newModelPaths.Select(x => x.Value).Union(
141+
newMaterialPaths.Select(x => x.Value)).Union(
142+
newAvfxPaths.Select(x => x.Value)).Union(
143+
newTexturePaths.Select(x => x.Value));
144+
145+
var allFiles = new HashSet<string>();
146+
foreach (var f in files)
147+
{
148+
allFiles.Add(f);
149+
}
150+
139151
if (ProgressReporter != null)
140152
{
141153
ProgressReporter.Report("Getting modlist...");
@@ -152,7 +164,17 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
152164
{
153165
if (mod.fullPath.StartsWith(dPath) && !mod.IsInternal())
154166
{
155-
await _modding.DeleteMod(mod.fullPath, false);
167+
if (Destination.Info.Slot == null)
168+
{
169+
// If this is a slotless root, purge everything.
170+
await _modding.DeleteMod(mod.fullPath, false);
171+
}
172+
else if(allFiles.Contains(mod.fullPath) || mod.fullPath.Contains(Destination.Info.Slot))
173+
{
174+
// Otherwise, only purge the files we're replacing, and anything else that
175+
// contains our slot name.
176+
await _modding.DeleteMod(mod.fullPath, false);
177+
}
156178
}
157179
}
158180

@@ -348,16 +370,6 @@ public static async Task CloneRoot(XivDependencyRoot Source, XivDependencyRoot D
348370
// Here we're going to go through and edit all the modded items to be joined together in a modpack for convenience.
349371
modlist = await _modding.GetModListAsync();
350372

351-
var files = newModelPaths.Select(x => x.Value).Union(
352-
newMaterialPaths.Select(x => x.Value)).Union(
353-
newAvfxPaths.Select(x => x.Value)).Union(
354-
newTexturePaths.Select(x => x.Value));
355-
356-
var allFiles = new HashSet<string>();
357-
foreach (var f in files)
358-
{
359-
allFiles.Add(f);
360-
}
361373

362374

363375
var modPack = new ModPack() { author = "System", name = "Item Copy - " + srcItem.Name, url = "", version = "1.0" };

0 commit comments

Comments
 (0)