* Parameters.cs (ParseArguments): If no project file is specified,
authorAnkit Jain <radical@corewars.org>
Thu, 24 Sep 2009 19:04:36 +0000 (19:04 -0000)
committerAnkit Jain <radical@corewars.org>
Thu, 24 Sep 2009 19:04:36 +0000 (19:04 -0000)
then look for a .sln or *proj file in the current directory.

svn path=/trunk/mcs/; revision=142595

mcs/tools/xbuild/ChangeLog
mcs/tools/xbuild/Parameters.cs

index 1b0818d9b98a5609c4a6d4c96c05e7658dc3e8d7..8a1df53eb33dd0333d27ccf89136292c6f7071a9 100644 (file)
@@ -1,3 +1,8 @@
+2009-09-24  Ankit Jain  <jankit@novell.com>
+
+       * Parameters.cs (ParseArguments): If no project file is specified,
+       then look for a .sln or *proj file in the current directory.
+
 2009-09-24  Ankit Jain  <jankit@novell.com>
 
        * Makefile: Create dir for WebApplication.targets .
index 3596bd94544e6372b5eee67e8bef83e65b9b48b6..1f36902f43d89b368ddcf76dfd2a019403dec550 100644 (file)
@@ -104,11 +104,22 @@ namespace Mono.XBuild.CommandLine {
                                        remainingArguments.Add (s);
                        }
                        if (remainingArguments.Count == 0) {
-                               string[] files = Directory.GetFiles (Directory.GetCurrentDirectory (), "*.??proj");
-                               if (files.Length > 0)
-                                       projectFile = files [0];
+                               string[] sln_files = Directory.GetFiles (Directory.GetCurrentDirectory (), "*.sln");
+                               string[] proj_files = Directory.GetFiles (Directory.GetCurrentDirectory (), "*proj");
+
+                               if (sln_files.Length == 0 && proj_files.Length == 0)
+                                       ErrorUtilities.ReportError (3, "Please specify the project or solution file " +
+                                                       "to build, as none was found in the current directory.");
+
+                               if (sln_files.Length + proj_files.Length > 1)
+                                       ErrorUtilities.ReportError (5, "Please specify the project or solution file " +
+                                                       "to build, as more than one solution or project file was found " +
+                                                       "in the current directory");
+
+                               if (sln_files.Length == 1)
+                                       projectFile = sln_files [0];
                                else
-                                       ErrorUtilities.ReportError (3, "No .proj file specified and no found in current directory.");
+                                       projectFile = proj_files [0];
                        } else if (remainingArguments.Count == 1) {
                                projectFile = (string) remainingArguments [0];
                        } else {