diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2018-10-22 19:20:29 +0200 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2018-10-25 18:00:17 +0200 |
commit | 611a476224b598c970a2d9a6815a0c7cd8093291 (patch) | |
tree | 9e8a1e2daadf29f54b913fedcc759120f180b92f /modules/mono/editor/GodotSharpTools/Project | |
parent | 454b933106bf8860c65f5b26a155a6bfe8cadaec (diff) |
Support globs in csproj includes
Diffstat (limited to 'modules/mono/editor/GodotSharpTools/Project')
-rw-r--r-- | modules/mono/editor/GodotSharpTools/Project/ProjectExtensions.cs | 16 |
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; } } } |