浏览代码

Handle csproj "Remove" globs

MSBuild Item returns empty strings if an attribute isn't set (which
caused an IndexOutOfRangeException in NormalizePath).

We were treating Excludes incorrectly, Remove directives provide the
intended behaviour in the auto-including csproj format.
Alex de la Mare 5 年之前
父节点
当前提交
8dbd7155b5

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

@@ -23,6 +23,9 @@ namespace GodotTools.Core
 
         public static string NormalizePath(this string path)
         {
+            if (string.IsNullOrEmpty(path))
+                return path;
+
             bool rooted = path.IsAbsolutePath();
 
             path = path.Replace('\\', '/');

+ 2 - 3
modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs

@@ -61,10 +61,9 @@ namespace GodotTools.ProjectEditor
                 if (item.ItemType != itemType)
                     continue;
 
-                string normalizedExclude = item.Exclude.NormalizePath();
-
-                var glob = MSBuildGlob.Parse(normalizedExclude);
+                string normalizedRemove = item.Remove.NormalizePath();
 
+                var glob = MSBuildGlob.Parse(normalizedRemove);
                 excluded.AddRange(includedFiles.Where(includedFile => glob.IsMatch(includedFile)));
             }