mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-28 18:09:42 -05:00
file: Report system error on failure to open file
This commit is contained in:
@@ -232,9 +232,10 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
|
||||
cmsys::ofstream file(fileName.c_str(), append?std::ios::app: std::ios::out);
|
||||
if ( !file )
|
||||
{
|
||||
std::string error = "Internal CMake error when trying to open file: ";
|
||||
error += fileName.c_str();
|
||||
error += " for writing.";
|
||||
std::string error = "failed to open for writing (";
|
||||
error += cmSystemTools::GetLastSystemError();
|
||||
error += "):\n ";
|
||||
error += fileName;
|
||||
this->SetError(error);
|
||||
return false;
|
||||
}
|
||||
@@ -292,9 +293,10 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
|
||||
|
||||
if ( !file )
|
||||
{
|
||||
std::string error = "Internal CMake error when trying to open file: ";
|
||||
error += fileName.c_str();
|
||||
error += " for reading.";
|
||||
std::string error = "failed to open for reading (";
|
||||
error += cmSystemTools::GetLastSystemError();
|
||||
error += "):\n ";
|
||||
error += fileName;
|
||||
this->SetError(error);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user