mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
add support for .mohidden and /optional/ esps in zEdit integration
This commit is contained in:
parent
7e87e9fefd
commit
a177a60c54
@ -73,10 +73,19 @@ namespace Wabbajack.Lib
|
||||
var result = source.EvolveTo<MergedPatch>();
|
||||
result.Sources = merge.plugins.Select(f =>
|
||||
{
|
||||
var abs_path = Path.Combine(f.dataFolder, f.filename);
|
||||
if (!File.Exists(abs_path))
|
||||
var orig_path = Path.Combine(f.dataFolder, f.filename);
|
||||
var paths = new[]
|
||||
{
|
||||
orig_path,
|
||||
orig_path + ".mohidden",
|
||||
Path.Combine(Path.GetDirectoryName(orig_path), "optional", Path.GetFileName(orig_path))
|
||||
};
|
||||
|
||||
var abs_path = paths.FirstOrDefault(p => File.Exists(p));
|
||||
|
||||
if (abs_path == null)
|
||||
throw new InvalidDataException(
|
||||
$"File {abs_path} is required to build {merge.filename} but it doesn't exist");
|
||||
$"File {abs_path} is required to build {merge.filename} but it doesn't exist searched in: \n" + String.Join("\n", paths));
|
||||
|
||||
return new SourcePatch
|
||||
{
|
||||
@ -85,7 +94,7 @@ namespace Wabbajack.Lib
|
||||
};
|
||||
}).ToList();
|
||||
|
||||
var src_data = merge.plugins.Select(f => File.ReadAllBytes(Path.Combine(f.dataFolder, f.filename)))
|
||||
var src_data = result.Sources.Select(f => File.ReadAllBytes(Path.Combine(_compiler.MO2Folder, f.RelativePath)))
|
||||
.ConcatArrays();
|
||||
|
||||
var dst_data = File.ReadAllBytes(source.AbsolutePath);
|
||||
|
@ -21,8 +21,8 @@ namespace Wabbajack.Test
|
||||
var modb = utils.AddMod();
|
||||
var moddest = utils.AddMod();
|
||||
var srca = utils.AddModFile(moda, @"srca.esp", 10);
|
||||
var srcb = utils.AddModFile(moda, @"srcb.esp", 10);
|
||||
var srcc = utils.AddModFile(modb, @"srcd.esp", 10);
|
||||
var srcb = utils.AddModFile(moda, @"srcb.esp.mohidden", 10);
|
||||
var srcc = utils.AddModFile(modb, @"optional\srcc.esp", 10);
|
||||
var dest = utils.AddModFile(moddest, @"merged.esp", 20);
|
||||
|
||||
var srcs = new List<string> {srca, srcb, srcc};
|
||||
@ -39,18 +39,18 @@ namespace Wabbajack.Test
|
||||
{
|
||||
new zEditIntegration.zEditMergePlugin()
|
||||
{
|
||||
filename = srca,
|
||||
dataFolder = Path.GetDirectoryName(srca),
|
||||
filename = "srca.esp",
|
||||
dataFolder = Path.Combine(utils.MO2Folder, "mods", moda)
|
||||
},
|
||||
new zEditIntegration.zEditMergePlugin()
|
||||
{
|
||||
filename = srcb,
|
||||
dataFolder = Path.GetDirectoryName(srcb),
|
||||
filename = "srcb.esp",
|
||||
dataFolder = Path.Combine(utils.MO2Folder, "mods", moda),
|
||||
},
|
||||
new zEditIntegration.zEditMergePlugin()
|
||||
{
|
||||
filename = srcc,
|
||||
dataFolder = Path.GetDirectoryName(srcc),
|
||||
filename = "srcc.esp",
|
||||
dataFolder = Path.Combine(utils.MO2Folder, "mods", modb),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user