Jelajahi Sumber

[3.2] 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 tahun lalu
induk
melakukan
6474e036ac

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

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

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

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