You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Avoid modifying csproj globbing includes on remove
Check if the found globbing include already matches the given path on removing scripts to avoid modifying users' csproj files.
This commit is contained in:
@@ -108,7 +108,21 @@ namespace GodotTools.ProjectEditor
|
||||
|
||||
var normalizedInclude = include.NormalizePath();
|
||||
|
||||
if (root.RemoveItemChecked(itemType, normalizedInclude))
|
||||
var item = root.FindItemOrNullAbs(itemType, normalizedInclude);
|
||||
|
||||
// Couldn't find an existing item that matches to remove
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
var glob = MSBuildGlob.Parse(item.Include);
|
||||
|
||||
// If the item include uses globbing don't remove it
|
||||
if (!string.IsNullOrEmpty(glob.WildcardDirectoryPart) || glob.FilenamePart.Contains("*"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
item.Parent.RemoveChild(item);
|
||||
root.Save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user