diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-11-04 20:01:40 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-11-04 20:01:40 (GMT) |
commit | dc919e841af7a0c864e687f19068406287664f06 (patch) | |
tree | c702d40f160075c853d91cc6c7323171ed5cab00 /Source/cmWriteFileCommand.cxx | |
parent | c45fc1e4b3015a2f610c023a157f16277f2de701 (diff) | |
download | CMake-dc919e841af7a0c864e687f19068406287664f06.zip CMake-dc919e841af7a0c864e687f19068406287664f06.tar.gz CMake-dc919e841af7a0c864e687f19068406287664f06.tar.bz2 |
Make directory if it does not exist yet
Diffstat (limited to 'Source/cmWriteFileCommand.cxx')
-rw-r--r-- | Source/cmWriteFileCommand.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 93ecd2d..ab7f957 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -44,12 +44,15 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& argsIn) message += *i; } } + std::string dir = cmSystemTools::GetFilenamePath(fileName); + cmSystemTools::MakeDirectory(dir.c_str()); std::ofstream file(fileName.c_str(), overwrite?std::ios::out : std::ios::app); if ( !file ) { - cmSystemTools::Error("Internal CMake error when trying to open file: ", - fileName.c_str()); + std::string error = "Internal CMake error when trying to open file: "; + error += fileName.c_str(); + this->SetError(error.c_str()); return false; } file << message << std::endl; |