Fix bug where Parser.NormalizePath() did not normalise \ in Unix-based operating systems (#2312)

This commit is contained in:
Alex Tan 2023-10-15 02:59:07 +11:00 committed by GitHub
parent 54dad5effa
commit 7882e5ad1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1043,7 +1043,7 @@ public static class Parser
/// <returns></returns> /// <returns></returns>
public static string NormalizePath(string? path) public static string NormalizePath(string? path)
{ {
return string.IsNullOrEmpty(path) ? string.Empty : path.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) return string.IsNullOrEmpty(path) ? string.Empty : path.Replace('\\', Path.AltDirectorySeparatorChar)
.Replace(@"//", Path.AltDirectorySeparatorChar + string.Empty); .Replace(@"//", Path.AltDirectorySeparatorChar + string.Empty);
} }