diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-07-08 20:33:29 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-07-08 20:33:29 (GMT) |
commit | d0964a349ee5a71f520a28afe353670e89563fd0 (patch) | |
tree | f302da006488df0c7d676ee0412ea720601b31a9 /Source/cmFileCommand.cxx | |
parent | cf9562694fb81674e6988a97b47443a8a6135b76 (diff) | |
download | CMake-d0964a349ee5a71f520a28afe353670e89563fd0.zip CMake-d0964a349ee5a71f520a28afe353670e89563fd0.tar.gz CMake-d0964a349ee5a71f520a28afe353670e89563fd0.tar.bz2 |
ENH: Add MAKE_DIRECTORY and modify documentation
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6b7f036..49f79d1 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -43,6 +43,10 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args) { return this->HandleGlobCommand(args); } + else if ( subCommand == "MAKE_DIRECTORY" ) + { + return this->HandleMakeDirectoryCommand(args); + } std::string e = "does not recognize sub-command "+subCommand; this->SetError(e.c_str()); @@ -175,3 +179,36 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args) m_Makefile->AddDefinition(variable.c_str(), output.c_str()); return true; } + +//---------------------------------------------------------------------------- +bool cmFileCommand::HandleMakeDirectoryCommand(std::vector<std::string> const& args) +{ + if(args.size() < 2 ) + { + this->SetError("called with incorrect number of arguments"); + return false; + } + + std::vector<std::string>::const_iterator i = args.begin(); + + i++; // Get rid of subcommand + + std::string expr; + for ( ; i != args.end(); ++i ) + { + const std::string* cdir = &(*i); + if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) + { + expr = m_Makefile->GetCurrentDirectory(); + expr += "/" + *i; + cdir = &expr; + } + if ( !cmSystemTools::MakeDirectory(cdir->c_str()) ) + { + std::string error = "problem creating directory: " + *cdir; + this->SetError(error.c_str()); + return false; + } + } + return true; +} |