summaryrefslogtreecommitdiff
path: root/modules/mono/editor/GodotSharpTools/Project
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2018-10-22 19:20:29 +0200
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2018-10-25 18:00:17 +0200
commit611a476224b598c970a2d9a6815a0c7cd8093291 (patch)
tree9e8a1e2daadf29f54b913fedcc759120f180b92f /modules/mono/editor/GodotSharpTools/Project
parent454b933106bf8860c65f5b26a155a6bfe8cadaec (diff)
Support globs in csproj includes
Diffstat (limited to 'modules/mono/editor/GodotSharpTools/Project')
-rw-r--r--modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs16
1 files changed, 12 insertions, 4 deletions
diff --git a/modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs b/modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs
index f00ec5a2ad..647d9ac81d 100644
--- a/modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs
+++ b/modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using DotNet.Globbing;
using Microsoft.Build.Construction;
namespace GodotSharpTools.Project
@@ -7,7 +8,10 @@ namespace GodotSharpTools.Project
{
public static bool HasItem(this ProjectRootElement root, string itemType, string include)
{
- string includeNormalized = include.NormalizePath();
+ GlobOptions globOptions = new GlobOptions();
+ globOptions.Evaluation.CaseInsensitive = false;
+
+ string normalizedInclude = include.NormalizePath();
foreach (var itemGroup in root.ItemGroups)
{
@@ -16,10 +20,14 @@ namespace GodotSharpTools.Project
foreach (var item in itemGroup.Items)
{
- if (item.ItemType == itemType)
+ if (item.ItemType != itemType)
+ continue;
+
+ var glob = Glob.Parse(item.Include.NormalizePath(), globOptions);
+
+ if (glob.IsMatch(normalizedInclude))
{
- if (item.Include.NormalizePath() == includeNormalized)
- return true;
+ return true;
}
}
}