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/cmWriteFileCommand.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Source/cmWriteFileCommand.cxx') diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 6cbde0ad20..8798abb3ca 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -45,6 +45,16 @@ bool cmWriteFileCommand::InitialPass(std::vector const& args) message += *i; } } + + if ( !this->Makefile->CanIWriteThisFile(fileName.c_str()) ) + { + std::string e = "attempted to write a file: " + fileName + + " into a source directory."; + this->SetError(e.c_str()); + cmSystemTools::SetFatalErrorOccured(); + return false; + } + std::string dir = cmSystemTools::GetFilenamePath(fileName); cmSystemTools::MakeDirectory(dir.c_str()); -- cgit v1.2.1