[xbuild] DirectoryScanner.HasWildcard - new method
authorAnkit Jain <radical@corewars.org>
Thu, 3 Mar 2011 14:30:13 +0000 (20:00 +0530)
committerAnkit Jain <radical@corewars.org>
Thu, 3 Mar 2011 19:20:30 +0000 (00:50 +0530)
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/DirectoryScanner.cs

index d16cbcf4a3d0a0e457520d5dff9adc64afdc61f9..d9c7345c4657dd93beae390b1d5b165402ccbe62 100644 (file)
@@ -83,7 +83,7 @@ namespace Microsoft.Build.BuildEngine {
                        FileInfo[] fileInfo;
 
                        string name = include_item.ItemSpec;
-                       if (name.IndexOf ('?') == -1 && name.IndexOf ('*') == -1) {
+                       if (!HasWildcard (name)) {
                                if (!excludedItems.ContainsKey (Path.GetFullPath(name)))
                                        includedItems.Add (include_item);
                        } else {
@@ -210,6 +210,11 @@ namespace Microsoft.Build.BuildEngine {
                                return fi;
                        }
                }
+
+               public static bool HasWildcard (string expression)
+               {
+                       return expression.IndexOf ('?') >= 0 || expression.IndexOf ('*') >= 0;
+               }
                
                public DirectoryInfo BaseDirectory {
                        get { return baseDirectory; }