ENH: added remove_directory bug 2937

This commit is contained in:
Ken Martin 2007-03-12 16:10:00 -04:00
parent e105c7fedc
commit f59e649dc2
1 changed files with 13 additions and 1 deletions

View File

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