summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-05-27 16:53:15 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-05-27 16:53:15 (GMT)
commitd1470b7d7c65b22f3f93183e68b1f8fed73e82fe (patch)
tree01e54afade847e80f3a79e14199fc7779c984f9f /Source
parent757cec6caac09f477330f8498bb692ecc17cde66 (diff)
downloadCMake-d1470b7d7c65b22f3f93183e68b1f8fed73e82fe.zip
CMake-d1470b7d7c65b22f3f93183e68b1f8fed73e82fe.tar.gz
CMake-d1470b7d7c65b22f3f93183e68b1f8fed73e82fe.tar.bz2
ENH: Detect if there were problems writing file
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e10b5ad..2633746 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2310,6 +2310,7 @@ void cmMakefile::ConfigureString(const std::string& input,
int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
bool copyonly, bool atOnly, bool escapeQuotes)
{
+ int res = 1;
if ( !cmSystemTools::FileExists(infile) )
{
cmSystemTools::Error("File ", infile, " does not exist.");
@@ -2369,12 +2370,18 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
// close the files before attempting to copy
fin.close();
fout.close();
- cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(),
- soutfile.c_str());
+ if ( !cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(),
+ soutfile.c_str()) )
+ {
+ res = 0;
+ }
+ else
+ {
+ cmSystemTools::SetPermissions(soutfile.c_str(), perm);
+ }
cmSystemTools::RemoveFile(tempOutputFile.c_str());
- cmSystemTools::SetPermissions(soutfile.c_str(), perm);
}
- return 1;
+ return res;
}
void cmMakefile::AddWrittenFile(const char* file)