2020-07-01 03:46:26 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Wabbajack.Common;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Lib.CompilationSteps
|
|
|
|
|
{
|
|
|
|
|
public class IgnoreSaveFiles : MO2CompilationStep
|
|
|
|
|
{
|
|
|
|
|
private AbsolutePath[] _profilePaths;
|
|
|
|
|
|
|
|
|
|
public IgnoreSaveFiles(ACompiler compiler) : base(compiler)
|
|
|
|
|
{
|
|
|
|
|
_profilePaths =
|
2020-10-18 12:59:49 +00:00
|
|
|
|
MO2Compiler.SelectedProfiles.Select(p => MO2Compiler.SourcePath.Combine("profiles", p, "saves")).ToArray();
|
2020-07-01 03:46:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override async ValueTask<Directive?> Run(RawSourceFile source)
|
|
|
|
|
{
|
|
|
|
|
if (!_profilePaths.Any(p => source.File.AbsoluteName.InFolder(p)))
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
var result = source.EvolveTo<IgnoredDirectly>();
|
|
|
|
|
result.Reason = "Ignore Save files";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|