Only LOOT user data for the selected game will be included

This commit is contained in:
erri120 2020-04-02 17:46:42 +02:00
parent 386cb247c6
commit e3ae59b14c
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135

View File

@ -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;