Skip to content

Commit

Permalink
feat: #21
Browse files Browse the repository at this point in the history
  • Loading branch information
Rast1234 committed Jan 13, 2024
1 parent 59b1d5a commit 7aa94b1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/SyncFaction.ModManager/XmlModels/ModInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,13 @@ public ModInfoOperations BuildOperations()
var fs = WorkDir.FileSystem;
var relativeModFiles = WorkDir.EnumerateFiles("*", SearchOption.AllDirectories).ToImmutableDictionary(x => fs.Path.GetRelativePath(WorkDir.FullName, x.FullName.ToLowerInvariant()));

// ignore replaces where "default" was selected
var replacesWithoutNops = TypedChanges.OfType<Replace>()
.Where(x => x.File != Extensions.NopName && x.NewFile != Extensions.NopName)
.ToList();

// map replacements inside vpp to relative paths
var references = TypedChanges.OfType<Replace>()
var references = replacesWithoutNops
.Select(x => new
{
vppPath = GetPaths(fs, x.File),
Expand All @@ -243,7 +248,7 @@ public ModInfoOperations BuildOperations()
}

var referencedFilesDict = referencedFiles.ToImmutableDictionary(static x => x.vppPath, static x => x.fileInfo!);
var replaceOperations = TypedChanges.OfType<Replace>().Select((x, i) => ConvertToOperation(x, i, fs, referencedFilesDict)).ToList();
var replaceOperations = replacesWithoutNops.Select((x, i) => ConvertToOperation(x, i, fs, referencedFilesDict)).ToList();
var editOperations = TypedChanges.OfType<Edit>().Select((x, i) => ConvertToOperation(x, i, fs)).ToList();
return new ModInfoOperations(replaceOperations, editOperations);
}
Expand Down

0 comments on commit 7aa94b1

Please sign in to comment.