[xbuild] Function names are case insensitive.
[mono.git] / mcs / class / Microsoft.Build.Engine / Microsoft.Build.BuildEngine / ConditionFunctionExpression.cs
index ae2bead1a576ef6772870b62a0293621a31e192d..1b532c38d9622e80bf868c633e6db612bc18c24a 100644 (file)
@@ -46,7 +46,7 @@ namespace Microsoft.Build.BuildEngine {
                        Type t = typeof (ConditionFunctionExpression);
                        string [] names = new string [] { "Exists", "HasTrailingSlash" };
                
-                       functions = new Dictionary <string, MethodInfo> ();
+                       functions = new Dictionary <string, MethodInfo> (StringComparer.InvariantCultureIgnoreCase);
                        foreach (string name in names)
                                functions.Add (name, t.GetMethod (name, BindingFlags.NonPublic | BindingFlags.Static));
                }
@@ -60,10 +60,10 @@ namespace Microsoft.Build.BuildEngine {
                public override  bool BoolEvaluate (Project context)
                {
                        if (!functions.ContainsKey (name))
-                               throw new InvalidOperationException ();
+                               throw new InvalidOperationException ("Unknown function named: " + name);
                        
                        if (functions [name] == null)
-                               throw new InvalidOperationException ();
+                               throw new InvalidOperationException ("Unknown function named: " + name);
                                
                        MethodInfo mi = functions [name];
                        object [] argsArr = new object [args.Count + 1];
@@ -113,7 +113,7 @@ namespace Microsoft.Build.BuildEngine {
                        if (!Path.IsPathRooted (file) && directory != null && directory != String.Empty)
                                file = Path.Combine (directory, file);
                
-                       return File.Exists (file);
+                       return File.Exists (file) || Directory.Exists (file);
                }
 
                static bool HasTrailingSlash (string file, Project context)