Skip to content
Snippets Groups Projects
Commit dc919e84 authored by Andy Cedilnik's avatar Andy Cedilnik
Browse files

Make directory if it does not exist yet

parent c45fc1e4
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment