Make directory if it does not exist yet
This commit is contained in:
parent
c45fc1e4b3
commit
dc919e841a
@ -44,12 +44,15 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& argsIn)
|
|||||||
message += *i;
|
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);
|
std::ofstream file(fileName.c_str(), overwrite?std::ios::out : std::ios::app);
|
||||||
if ( !file )
|
if ( !file )
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Internal CMake error when trying to open file: ",
|
std::string error = "Internal CMake error when trying to open file: ";
|
||||||
fileName.c_str());
|
error += fileName.c_str();
|
||||||
|
this->SetError(error.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file << message << std::endl;
|
file << message << std::endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user