From ee1975570e60e472e467733a840c30c583fb95cc Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Wed, 22 Mar 2006 14:40:36 -0500 Subject: ENH: Allow blocking of writing into the source tree --- Source/cmMakeDirectoryCommand.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Source/cmMakeDirectoryCommand.cxx') diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx index b1a2821222..3696296a87 100644 --- a/Source/cmMakeDirectoryCommand.cxx +++ b/Source/cmMakeDirectoryCommand.cxx @@ -24,6 +24,14 @@ bool cmMakeDirectoryCommand::InitialPass(std::vector const& args) this->SetError("called with incorrect number of arguments"); return false; } + if ( !this->Makefile->CanIWriteThisFile(args[0].c_str()) ) + { + std::string e = "attempted to create a directory: " + args[0] + + " into a source directory."; + this->SetError(e.c_str()); + cmSystemTools::SetFatalErrorOccured(); + return false; + } cmSystemTools::MakeDirectory(args[0].c_str()); return true; } -- cgit v1.2.1