BUG: the directory the FILE DOWNLOAD command is writing to might not exist.
This commit is contained in:
parent
b40890c8ca
commit
cddb1346b7
@ -2060,6 +2060,17 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
|
|||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string dir = cmSystemTools::GetFilenamePath(file.c_str());
|
||||||
|
if(!cmSystemTools::FileExists(dir.c_str()) &&
|
||||||
|
!cmSystemTools::MakeDirectory(dir.c_str()))
|
||||||
|
{
|
||||||
|
std::string errstring = "FILE(DOWNLOAD ) error; cannot create directory: "
|
||||||
|
+ dir + ". Maybe need administrative privileges.";
|
||||||
|
this->SetError(errstring.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::ofstream fout(file.c_str(), std::ios::binary);
|
std::ofstream fout(file.c_str(), std::ios::binary);
|
||||||
if(!fout)
|
if(!fout)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user