1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-04 19:21:46 +00:00

Merge pull request #54262 from raulsntos/csproj-globbing-3.x

This commit is contained in:
Rémi Verschelde
2021-10-26 21:56:58 +02:00
committed by GitHub

View File

@@ -77,6 +77,19 @@ namespace GodotTools.ProjectEditor
if (item == null)
return;
// Check if the found item include already matches the new path
var glob = MSBuildGlob.Parse(item.Include);
if (glob.IsMatch(normalizedNewInclude))
return;
// Otherwise, if the item include uses globbing it's better to add a new item instead of modifying
if (!string.IsNullOrEmpty(glob.WildcardDirectoryPart) || glob.FilenamePart.Contains("*"))
{
root.AddItem(itemType, normalizedNewInclude.RelativeToPath(dir).Replace("/", "\\"));
root.Save();
return;
}
item.Include = normalizedNewInclude.RelativeToPath(dir).Replace("/", "\\");
root.Save();
}
@@ -315,7 +328,7 @@ namespace GodotTools.ProjectEditor
// Godot API References
var apiAssemblies = new[] {ApiAssemblyNames.Core, ApiAssemblyNames.Editor};
var apiAssemblies = new[] { ApiAssemblyNames.Core, ApiAssemblyNames.Editor };
RemoveElements(root.ItemGroups.SelectMany(g => g.Items)
.Where(i => i.ItemType == "Reference" && apiAssemblies.Contains(i.Include)));