diff options
Diffstat (limited to 'Source/cmWriteFileCommand.cxx')
-rw-r--r-- | Source/cmWriteFileCommand.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 6cbde0a..8798abb 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -45,6 +45,16 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> 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()); |