summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-05-20 14:42:13 (GMT)
committerBrad King <brad.king@kitware.com>2014-05-20 15:07:51 (GMT)
commit2c448dbfe762278480bfd4f8ba9f458f9a104941 (patch)
tree2f968f7d4af76e4017c4fb9eb4f9c37c624bdc83 /Source/cmFileCommand.cxx
parent2d5e3d2d2bfd79311c40db173d13f6d0cfb10019 (diff)
downloadCMake-2c448dbfe762278480bfd4f8ba9f458f9a104941.zip
CMake-2c448dbfe762278480bfd4f8ba9f458f9a104941.tar.gz
CMake-2c448dbfe762278480bfd4f8ba9f458f9a104941.tar.bz2
file: Report system error on failure to open file
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;
}