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
Check if the found globbing include already matches the new path on moving scripts to avoid modifying users' csproj files.
This commit is contained in:
@@ -77,6 +77,19 @@ namespace GodotTools.ProjectEditor
|
|||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
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("/", "\\");
|
item.Include = normalizedNewInclude.RelativeToPath(dir).Replace("/", "\\");
|
||||||
root.Save();
|
root.Save();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user