summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 5bfb664..4ee34df 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -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;
}