diff options
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 56f93eb..6c4ad5c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -20,6 +20,7 @@ #include <sys/types.h> #include <sys/stat.h> +#include <cmsys/Directory.hxx> // cmLibraryCommand bool cmFileCommand::InitialPass(std::vector<std::string> const& args) @@ -54,6 +55,14 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args) { return this->HandleMakeDirectoryCommand(args); } + else if ( subCommand == "REMOVE" ) + { + return this->HandleRemove(args, false); + } + else if ( subCommand == "REMOVE_RECURSE" ) + { + return this->HandleRemove(args, true); + } else if ( subCommand == "INSTALL" ) { return this->HandleInstallCommand(args); @@ -857,3 +866,26 @@ bool cmFileCommand::HandleRelativePathCommand( } +//---------------------------------------------------------------------------- +bool cmFileCommand::HandleRemove(std::vector<std::string> const& args, + bool recurse) +{ + + std::string message; + std::vector<std::string>::const_iterator i = args.begin(); + + i++; // Get rid of subcommand + for(;i != args.end(); ++i) + { + if(cmSystemTools::FileIsDirectory(i->c_str()) && recurse) + { + cmSystemTools::RemoveADirectory(i->c_str()); + } + else + { + cmSystemTools::RemoveFile(i->c_str()); + } + } + return true; +} + |