Explorar el Código

ENH: Report error and exit when the current directory is not specified

Andy Cedilnik hace 21 años
padre
commit
4d55c6540a
Se han modificado 2 ficheros con 19 adiciones y 2 borrados
  1. 9 1
      Source/cmakemain.cxx
  2. 10 1
      Source/ctest.cxx

+ 9 - 1
Source/cmakemain.cxx

@@ -110,7 +110,15 @@ int main(int ac, char** av)
 int do_cmake(int ac, char** av)
 {
   cmDocumentation doc;
-  if(doc.CheckOptions(ac, av))
+  int nocwd = 0;
+
+  if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
+    {
+    std::cerr << "Current working directory cannot be established." << std::endl;
+    nocwd = 1;
+    }
+
+  if(doc.CheckOptions(ac, av) || nocwd)
     {
     // Construct and print requested documentation.
     cmake hcm;

+ 10 - 1
Source/ctest.cxx

@@ -101,6 +101,15 @@ static const cmDocumentationEntry cmDocumentationSeeAlso[] =
 int main (int argc, char *argv[])
 {
   cmSystemTools::EnableMSVCDebugHook();
+  int nocwd = 0;
+
+  if ( cmSystemTools::GetCurrentWorkingDirectory().size() == 0 )
+    {
+    std::cerr << "Current working directory cannot be established." << std::endl;
+    nocwd = 1;
+    }
+
+
   
   // If there is a testing input file, check for documentation options
   // only if there are actually arguments.  We want running without
@@ -114,7 +123,7 @@ int main (int argc, char *argv[])
       std::cout << "*********************************" << std::endl;
       }
     cmDocumentation doc;
-    if(doc.CheckOptions(argc, argv))
+    if(doc.CheckOptions(argc, argv) || nocwd)
       {
       // Construct and print requested documentation.
       doc.SetName("ctest");