Просмотр исходного кода

ENH: added remove_directory bug 2937

Ken Martin 19 лет назад
Родитель
Сommit
f59e649dc2
1 измененных файлов с 13 добавлено и 1 удалено
  1. 13 1
      Source/cmake.cxx

+ 13 - 1
Source/cmake.cxx

@@ -801,6 +801,7 @@ void CMakeCommandUsage(const char* program)
     " line\n"
     << "  environment             - display the current enviroment\n"
     << "  make_directory dir      - create a directory\n"
+    << "  remove_directory dir    - remove a directory and its contents\n"
     << "  remove file1 file2 ...  - remove the file(s)\n"
     << "  tar [cxt][vfz] file.tar file/dir1 file/dir2 ... - create a tar.\n"
     << "  time command [args] ... - run command and return elapsed time\n"
@@ -914,7 +915,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
       }
 #endif
     
-    if (args[1] == "make_directory" && args.size() == 3)
+    else if (args[1] == "make_directory" && args.size() == 3)
       {
       if(!cmSystemTools::MakeDirectory(args[2].c_str()))
         {
@@ -925,6 +926,17 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
       return 0;
       }
 
+    else if (args[1] == "remove_directory" && args.size() == 3)
+      {
+      if(!cmSystemTools::RemoveADirectory(args[2].c_str()))
+        {
+        std::cerr << "Error removing directory \"" << args[2].c_str()
+                  << "\".\n";
+        return 1;
+        }
+      return 0;
+      }
+
     // Remove file
     else if (args[1] == "remove" && args.size() > 2)
       {