From e3ae59b14c28a7270eb464567bf9b79a44791e68 Mon Sep 17 00:00:00 2001 From: erri120 Date: Thu, 2 Apr 2020 17:46:42 +0200 Subject: [PATCH] Only LOOT user data for the selected game will be included --- Wabbajack.Lib/MO2Compiler.cs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Wabbajack.Lib/MO2Compiler.cs b/Wabbajack.Lib/MO2Compiler.cs index 16a90de3..f625c561 100644 --- a/Wabbajack.Lib/MO2Compiler.cs +++ b/Wabbajack.Lib/MO2Compiler.cs @@ -125,9 +125,27 @@ namespace Wabbajack.Lib if (Directory.Exists(lootPath)) { - lootFiles = Directory.EnumerateFiles(lootPath, "userlist.yaml", SearchOption.AllDirectories) - .Where(p => p.FileExists()) - .Select(p => new RawSourceFile(VFS.Index.ByRootPath[p], Path.Combine(Consts.LOOTFolderFilesDir, p.RelativeTo(lootPath)))); + var lootGameDirs = new [] + { + CompilingGame.MO2Name, // most of the games use the MO2 name + CompilingGame.MO2Name.Replace(" ", "") //eg: Fallout 4 -> Fallout4 + }; + + var lootGameDir = lootGameDirs.Select(x => Path.Combine(lootPath, x)) + .FirstOrDefault(Directory.Exists); + + if (lootGameDir != null) + { + Utils.Log($"Found LOOT game folder at {lootGameDir}"); + lootFiles = Directory.EnumerateFiles(lootGameDir, "userlist.yaml", SearchOption.TopDirectoryOnly) + .Where(p => p.FileExists()) + .Select(p => new RawSourceFile(VFS.Index.ByRootPath[p], + Path.Combine(Consts.LOOTFolderFilesDir, p.RelativeTo(lootPath)))); + + if (!lootFiles.Any()) + Utils.Log( + $"Found no LOOT user data for {CompilingGame.HumanFriendlyGameName} at {lootGameDir}!"); + } } if (cancel.IsCancellationRequested) return false;