Fix parsing of C# files with spaces in the path

(cherry picked from commit 9e8a5e4b5a)
This commit is contained in:
Ignacio Etcheverry 2020-09-04 00:58:49 +02:00 committed by Rémi Verschelde
parent 9efd555c58
commit 9699e83e1e
1 changed files with 4 additions and 3 deletions

View File

@ -14,10 +14,11 @@ namespace GodotTools.Core
if (Path.DirectorySeparatorChar == '\\')
dir = dir.Replace("/", "\\") + "\\";
Uri fullPath = new Uri(Path.GetFullPath(path), UriKind.Absolute);
Uri relRoot = new Uri(Path.GetFullPath(dir), UriKind.Absolute);
var fullPath = new Uri(Path.GetFullPath(path), UriKind.Absolute);
var relRoot = new Uri(Path.GetFullPath(dir), UriKind.Absolute);
return relRoot.MakeRelativeUri(fullPath).ToString();
// MakeRelativeUri converts spaces to %20, hence why we need UnescapeDataString
return Uri.UnescapeDataString(relRoot.MakeRelativeUri(fullPath).ToString());
}
public static string NormalizePath(this string path)