소스 검색

Merge pull request #41747 from neikeq/issue-41446

Fix parsing of C# files with spaces in the path
Rémi Verschelde 5 년 전
부모
커밋
15efe040f9
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs

+ 4 - 3
modules/mono/editor/GodotTools/GodotTools.Core/StringExtensions.cs

@@ -14,10 +14,11 @@ namespace GodotTools.Core
             if (Path.DirectorySeparatorChar == '\\')
             if (Path.DirectorySeparatorChar == '\\')
                 dir = dir.Replace("/", "\\") + "\\";
                 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)
         public static string NormalizePath(this string path)