wabbajack/Wabbajack.Lib/CompilationSteps/IgnoreGameFiles.cs
Chris Bessent 35b910be98 Make more path comparisons ignore case
Paths for Windows should be case-agnostic.  The primary impetus for
this change is to prevent WJ from deleting downloads if the case of
the folder name doesn't match the case of the install setting.
Normally this would be caught by the GUI validation but several users
have managed to get around that.
2020-11-18 20:04:43 -07:00

25 lines
719 B
C#

using System.Threading.Tasks;
using Newtonsoft.Json;
using Wabbajack.Common;
namespace Wabbajack.Lib.CompilationSteps
{
public class IgnoreGameFiles : ACompilationStep
{
private readonly string _startDir;
public IgnoreGameFiles(ACompiler compiler) : base(compiler)
{
_startDir = Consts.GameFolderFilesDir + "\\";
}
public override async ValueTask<Directive?> Run(RawSourceFile source)
{
if (!((string)source.Path).StartsWith(_startDir, System.StringComparison.OrdinalIgnoreCase)) return null;
var i = source.EvolveTo<IgnoredDirectly>();
i.Reason = "Default game file";
return i;
}
}
}