summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-04-29 12:47:04 (GMT)
committerBrad King <brad.king@kitware.com>2009-04-29 12:47:04 (GMT)
commitbc6eec18dc6d92dbbcbd805f149796bca2b6ca4b (patch)
tree338108fe28aefa23dc56f7771e7e029071e3154e /Source/cmFileCommand.cxx
parentf180a834bff54c51d7d30612249ebca4df39657c (diff)
downloadCMake-bc6eec18dc6d92dbbcbd805f149796bca2b6ca4b.zip
CMake-bc6eec18dc6d92dbbcbd805f149796bca2b6ca4b.tar.gz
CMake-bc6eec18dc6d92dbbcbd805f149796bca2b6ca4b.tar.bz2
ENH: Better error on file perm or time failure
This improves the error message produced during installation when CMake cannot set file modification time or permissions.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx42
1 files changed, 16 insertions, 26 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index d29e421..c3d596f 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -1000,6 +1000,18 @@ public:
this->Manifest += file.substr(this->DestDirLength);
}
+ bool SetPermissions(const char* toFile, mode_t permissions)
+ {
+ if(permissions && !cmSystemTools::SetPermissions(toFile, permissions))
+ {
+ cmOStringStream e;
+ e << "INSTALL cannot set permissions on \"" << toFile << "\"";
+ this->FileCommand->SetError(e.str().c_str());
+ return false;
+ }
+ return true;
+ }
+
// Translate an argument to a permissions bit.
bool CheckPermissions(std::string const& arg, mode_t& permissions)
{
@@ -1138,7 +1150,7 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile)
if (!cmSystemTools::CopyFileTime(fromFile, toFile))
{
cmOStringStream e;
- e << "Problem setting modification time on file \"" << toFile << "\"";
+ e << "INSTALL cannot set modification time on \"" << toFile << "\"";
this->FileCommand->SetError(e.str().c_str());
return false;
}
@@ -1153,15 +1165,7 @@ bool cmFileInstaller::InstallFile(const char* fromFile, const char* toFile)
// that the source file permissions be used.
cmSystemTools::GetPermissions(fromFile, permissions);
}
- if(permissions && !cmSystemTools::SetPermissions(toFile, permissions))
- {
- cmOStringStream e;
- e << "Problem setting permissions on file \"" << toFile << "\"";
- this->FileCommand->SetError(e.str().c_str());
- return false;
- }
-
- return true;
+ return this->SetPermissions(toFile, permissions);
}
//----------------------------------------------------------------------------
@@ -1230,13 +1234,8 @@ bool cmFileInstaller::InstallDirectory(const char* source,
}
// Set the required permissions of the destination directory.
- if(permissions_before &&
- !cmSystemTools::SetPermissions(destination, permissions_before))
+ if(!this->SetPermissions(destination, permissions_before))
{
- cmOStringStream e;
- e << "Problem setting permissions on directory \""
- << destination << "\"";
- this->FileCommand->SetError(e.str().c_str());
return false;
}
@@ -1280,16 +1279,7 @@ bool cmFileInstaller::InstallDirectory(const char* source,
}
// Set the requested permissions of the destination directory.
- if(permissions_after &&
- !cmSystemTools::SetPermissions(destination, permissions_after))
- {
- cmOStringStream e;
- e << "Problem setting permissions on directory \"" << destination << "\"";
- this->FileCommand->SetError(e.str().c_str());
- return false;
- }
-
- return true;
+ return this->SetPermissions(destination, permissions_after);
}
//----------------------------------------------------------------------------