Several compilation fixes

This commit is contained in:
Timothy Baldridge 2022-09-19 20:56:03 -06:00
parent a841ed0ce6
commit 57edbffb5f
4 changed files with 19 additions and 6 deletions

View File

@ -1,5 +1,9 @@
### Changelog ### Changelog
#### Version - 3.0.1.3 - 9/??/2022
* Auto-include splash.png files when compiling
* Fix support for `WABBAJACK_NOMATCH_INCLUDE_FILES.txt` and other variants
#### Version - 3.0.1.2 - 9/19/2022 #### Version - 3.0.1.2 - 9/19/2022
* Fix error with FNV BSAs not building properly when files are in the root folder * Fix error with FNV BSAs not building properly when files are in the root folder
* Fix for UnknownError in the Launcher (will require the Wabbajack.exe launcher to be re-downloaded) * Fix for UnknownError in the Launcher (will require the Wabbajack.exe launcher to be re-downloaded)

View File

@ -14,7 +14,7 @@ public class IncludeRegex : ACompilationStep
public IncludeRegex(ACompiler compiler, string pattern) : base(compiler) public IncludeRegex(ACompiler compiler, string pattern) : base(compiler)
{ {
_pattern = pattern; _pattern = pattern;
_regex = new Regex(pattern, RegexOptions.Compiled); _regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
} }
public override async ValueTask<Directive?> Run(RawSourceFile source) public override async ValueTask<Directive?> Run(RawSourceFile source)

View File

@ -67,13 +67,13 @@ public class CompilerSettingsInferencer
cs.Include = Array.Empty<RelativePath>(); cs.Include = Array.Empty<RelativePath>();
foreach (var file in mo2Folder.EnumerateFiles()) foreach (var file in mo2Folder.EnumerateFiles())
{ {
if (file.FileName.WithoutExtension().ToString() == Consts.WABBAJACK_INCLUDE) if (MatchesVariants(file, Consts.WABBAJACK_INCLUDE))
cs.Include = cs.Include.Add(file.Parent.RelativeTo(mo2Folder)); cs.Include = cs.Include.Add(file.Parent.RelativeTo(mo2Folder));
if (file.FileName.WithoutExtension().ToString() == Consts.WABBAJACK_NOMATCH_INCLUDE) if (MatchesVariants(file, Consts.WABBAJACK_NOMATCH_INCLUDE))
cs.NoMatchInclude = cs.NoMatchInclude.Add(file.Parent.RelativeTo(mo2Folder)); cs.NoMatchInclude = cs.NoMatchInclude.Add(file.Parent.RelativeTo(mo2Folder));
if (file.FileName.WithoutExtension().ToString() == Consts.WABBAJACK_IGNORE) if (MatchesVariants(file, Consts.WABBAJACK_IGNORE))
cs.Ignore = cs.Ignore.Add(file.Parent.RelativeTo(mo2Folder)); cs.Ignore = cs.Ignore.Add(file.Parent.RelativeTo(mo2Folder));
} }
@ -120,4 +120,12 @@ public class CompilerSettingsInferencer
return null; return null;
} }
private static bool MatchesVariants(AbsolutePath file, string baseVariant)
{
var withoutExt = file.FileName.WithoutExtension().ToString();
return withoutExt == baseVariant ||
withoutExt == baseVariant + "_FILES";
}
} }

View File

@ -292,8 +292,9 @@ public class MO2Compiler : ACompiler
new IgnoreFilename(this, "portable.txt".ToRelativePath()), new IgnoreFilename(this, "portable.txt".ToRelativePath()),
new IgnoreExtension(this, Ext.Bin), new IgnoreExtension(this, Ext.Bin),
new IgnoreFilename(this, ".refcache".ToRelativePath()), new IgnoreFilename(this, ".refcache".ToRelativePath()),
//Include custom categories //Include custom categories / splash screens
new IncludeRegex(this, "categories.dat$"), new IncludeRegex(this, @"categories\.dat$"),
new IncludeRegex(this, @"splash\.png"),
new IncludeAllConfigs(this), new IncludeAllConfigs(this),
// TODO // TODO