From b67c99bb3205cee76f500037df139380b19b44dd Mon Sep 17 00:00:00 2001 From: halgari Date: Tue, 8 Oct 2024 22:47:40 -0600 Subject: [PATCH] Comments for what's happening when installing bundled mods --- src/NexusMods.Collections/InstallCollectionJob.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/NexusMods.Collections/InstallCollectionJob.cs b/src/NexusMods.Collections/InstallCollectionJob.cs index c45475527..a952c9aba 100644 --- a/src/NexusMods.Collections/InstallCollectionJob.cs +++ b/src/NexusMods.Collections/InstallCollectionJob.cs @@ -150,7 +150,9 @@ await Parallel.ForEachAsync(toInstall, context.CancellationToken, async (file, _ private async Task InstallBundledMod(LoadoutId loadoutId, Mod fileMod, LoadoutItemGroup.ReadOnly group, LibraryArchive.ReadOnly collectionArchive) { + // Bundled mods are found inside the collection archive, so we'll have to find the files that are prefixed with the mod's source file expression. var prefixPath = "bundled".ToRelativePath().Join(fileMod.Source.FileExpression); + // These are the files to install var prefixFiles = collectionArchive.Children.Where(f => f.Path.InFolder(prefixPath)).ToArray(); using var tx = Connection.BeginTransaction(); @@ -158,6 +160,7 @@ await Parallel.ForEachAsync(toInstall, context.CancellationToken, async (file, _ if (!collectionArchive.AsLibraryFile().TryGetAsNexusModsCollectionLibraryFile(out var collectionFile)) throw new InvalidOperationException("The source collection is not a NexusModsCollectionLibraryFile."); + // Create the mod group var modGroup = new NexusCollectionBundledLoadoutGroup.New(tx, out var id) { CollectionLibraryFileId = collectionFile, @@ -175,7 +178,10 @@ await Parallel.ForEachAsync(toInstall, context.CancellationToken, async (file, _ foreach (var file in prefixFiles) { + // Remove the prefix path from the file path var fixedPath = file.Path.RelativeTo(prefixPath); + + // Fill out the rest of the file information _ = new LoadoutFile.New(tx, out var fileId) { Hash = file.AsLibraryFile().Hash,