summaryrefslogtreecommitdiffstats
path: root/Source/cmWriteFileCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-11-04 20:01:40 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-11-04 20:01:40 (GMT)
commitdc919e841af7a0c864e687f19068406287664f06 (patch)
treec702d40f160075c853d91cc6c7323171ed5cab00 /Source/cmWriteFileCommand.cxx
parentc45fc1e4b3015a2f610c023a157f16277f2de701 (diff)
downloadCMake-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.cxx7
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;