mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Added ability for WJ to ignore tagged folders.
+ (instructions in the readme)
This commit is contained in:
parent
c13e7b4f48
commit
76f09429e1
@ -131,7 +131,10 @@ You can create an empty `tagfile` with no extention in any folder you want to ap
|
||||
| Flag/File | Description | Notes |
|
||||
|------|-------------|-------|
|
||||
| `WABBAJACK_INCLUDE` | All files in this folder will be inlined into the `.wabbajack` file | |
|
||||
| `WABBAJACK_NOMATCH_INCLUDE` | All files in this folder will be inlined into the `.wabbajack` file even if Wabbajack did not found a match for them | Useful for generated files.|
|
||||
| `WABBAJACK_NOMATCH_INCLUDE` | All files in this folder will be inlined into the `.wabbajack` file even if Wabbajack did not found a match for them. | Useful for generated files.|
|
||||
| `WABBAJACK_IGNORE` | All files in this folder will be ignored by Wabbajack and therefore not be put into into the `.wabbajack` file. | Useful for tools or other things outside a mod you don't want/need reproduced on a users machine. Handle with care since excluded stuff can potentially break a setup.\* |
|
||||
|
||||
\*It will finish the installation of a modlist, but the installed list might not run if you excluded a crutial part of it.
|
||||
|
||||
#### Patches
|
||||
|
||||
|
@ -46,6 +46,7 @@ namespace Wabbajack.Common
|
||||
public static string WABBAJACK_ALWAYS_ENABLE = "WABBAJACK_ALWAYS_ENABLE";
|
||||
public static string WABBAJACK_ALWAYS_DISABLE = "WABBAJACK_ALWAYS_DISABLE";
|
||||
public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE";
|
||||
public static string WABBAJACK_IGNORE = "WABBAJACK_IGNORE";
|
||||
|
||||
public static string GAME_PATH_MAGIC_BACK = "{--||GAME_PATH_MAGIC_BACK||--}";
|
||||
public static string GAME_PATH_MAGIC_DOUBLE_BACK = "{--||GAME_PATH_MAGIC_DOUBLE_BACK||--}";
|
||||
|
43
Wabbajack.Lib/CompilationSteps/IgnoreTaggedFolders.cs
Normal file
43
Wabbajack.Lib/CompilationSteps/IgnoreTaggedFolders.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class IgnoreTaggedFolders : ACompilationStep
|
||||
{
|
||||
private readonly IEnumerable<AbsolutePath> _ignoreDirecrtory = new List<AbsolutePath>();
|
||||
private readonly string _tag;
|
||||
private readonly ACompiler _aCompiler;
|
||||
private readonly AbsolutePath _sourcePath;
|
||||
private readonly string _reason;
|
||||
|
||||
public IgnoreTaggedFolders(ACompiler compiler, string tag) : base(compiler)
|
||||
{
|
||||
_aCompiler = (ACompiler)compiler;
|
||||
_sourcePath = _aCompiler.SourcePath;
|
||||
_tag = tag;
|
||||
string rootDirectory = (string)_sourcePath;
|
||||
_reason = $"Ignored because folder was tagged with {_tag}";
|
||||
|
||||
_ignoreDirecrtory = Directory.EnumerateFiles(rootDirectory, _tag, SearchOption.AllDirectories).Select(str => (AbsolutePath)str.Replace(_tag, ""));
|
||||
}
|
||||
|
||||
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
||||
{
|
||||
foreach (var folderpath in _ignoreDirecrtory)
|
||||
{
|
||||
if (!source.AbsolutePath.InFolder(folderpath)) continue;
|
||||
var result = source.EvolveTo<IgnoredDirectly>();
|
||||
result.Reason = _reason;
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -30,7 +30,6 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
foreach (var folderpath in _includeDirectly)
|
||||
{
|
||||
Utils.Log($"IncludeTaggedFolders Taggedfolder: {folderpath}");
|
||||
if (!source.AbsolutePath.InFolder(folderpath)) continue;
|
||||
var result = source.EvolveTo<InlineFile>();
|
||||
result.SourceDataID = await _compiler.IncludeFile(source.AbsolutePath);
|
||||
|
@ -437,6 +437,7 @@ namespace Wabbajack.Lib
|
||||
new IgnorePathContains(this, "SSEEdit Cache"),
|
||||
new IgnoreOtherProfiles(this),
|
||||
new IgnoreDisabledMods(this),
|
||||
new IgnoreTaggedFolders(this,Consts.WABBAJACK_IGNORE),
|
||||
new IncludeThisProfile(this),
|
||||
// Ignore the ModOrganizer.ini file it contains info created by MO2 on startup
|
||||
new IncludeStubbedConfigFiles(this),
|
||||
|
@ -279,11 +279,12 @@ namespace Wabbajack.Lib
|
||||
return step[0] switch
|
||||
{
|
||||
"IgnoreStartsWith" => new IgnoreStartsWith(this, step[1]),
|
||||
"IgnoreTaggedFolders" => new IgnoreTaggedFolders(this, Consts.WABBAJACK_IGNORE),
|
||||
"IncludeTaggedFolders" => new IncludeTaggedFolders(this, Consts.WABBAJACK_INCLUDE),
|
||||
"IncludeConfigs" => new IncludeAllConfigs(this),
|
||||
"IncludeDirectMatches" => new DirectMatch(this),
|
||||
"IncludePatches" => new IncludePatches(this),
|
||||
"IncludeMissingFilesInTaggedFolders" => new IncludeTaggedFolders(this, Consts.WABBAJACK_NOMATCH_INCLUDE),
|
||||
"IncludeUnmatchedFilesInTaggedFolders" => new IncludeTaggedFolders(this, Consts.WABBAJACK_NOMATCH_INCLUDE),
|
||||
_ => throw new ArgumentException($"No interpretation for step {step[0]}")
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user