Merge pull request #1191 from LostDragonist/ignoredircase

Make more path comparisons ignore case
This commit is contained in:
Timothy Baldridge 2020-11-18 21:34:17 -07:00 committed by GitHub
commit a195f5af80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View File

@ -275,7 +275,7 @@ namespace Wabbajack.Common
public bool InFolder(AbsolutePath folder)
{
return _path.StartsWith(folder._path + Path.DirectorySeparator);
return _path.StartsWith(folder._path + Path.DirectorySeparator, StringComparison.OrdinalIgnoreCase);
}
public async Task<byte[]> ReadAllBytesAsync()
@ -386,7 +386,7 @@ namespace Wabbajack.Common
public int CompareTo(AbsolutePath other)
{
return string.Compare(_path, other._path, StringComparison.Ordinal);
return string.Compare(_path, other._path, StringComparison.OrdinalIgnoreCase);
}
public string ReadAllText()

View File

@ -136,12 +136,12 @@ namespace Wabbajack.Common
public bool StartsWith(string s)
{
return _path.StartsWith(s);
return _path.StartsWith(s, StringComparison.OrdinalIgnoreCase);
}
public bool StartsWith(RelativePath s)
{
return _path.StartsWith(s._path);
return _path.StartsWith(s._path, StringComparison.OrdinalIgnoreCase);
}
public RelativePath Combine(params RelativePath[] paths )
@ -156,7 +156,7 @@ namespace Wabbajack.Common
public int CompareTo(RelativePath other)
{
return string.Compare(_path, other._path, StringComparison.Ordinal);
return string.Compare(_path, other._path, StringComparison.OrdinalIgnoreCase);
}
}
}

View File

@ -866,7 +866,7 @@ namespace Wabbajack.Common
public static bool IsInPath(this string path, string parent)
{
return path.ToLower().TrimEnd('\\').StartsWith(parent.ToLower().TrimEnd('\\') + "\\");
return path.ToLower().TrimEnd('\\').StartsWith(parent.ToLower().TrimEnd('\\') + "\\", StringComparison.OrdinalIgnoreCase);
}
public static async Task CopyToLimitAsync(this Stream frm, Stream tw, long limit)

View File

@ -15,7 +15,7 @@ namespace Wabbajack.Lib.CompilationSteps
public override async ValueTask<Directive?> Run(RawSourceFile source)
{
if (!((string)source.Path).StartsWith(_startDir)) return null;
if (!((string)source.Path).StartsWith(_startDir, System.StringComparison.OrdinalIgnoreCase)) return null;
var i = source.EvolveTo<IgnoredDirectly>();
i.Reason = "Default game file";
return i;