diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-09-29 16:20:52 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-09-29 16:20:52 (GMT) |
commit | 3fc7dc5e70cd444731dd3adcc4599f9750e4936c (patch) | |
tree | 99f891a85d30981fa83a68c09ab33922356ec2fc /Source/cmSystemTools.cxx | |
parent | cf8d34040e66e2ffb13b4f6598024b38e298633d (diff) | |
download | CMake-3fc7dc5e70cd444731dd3adcc4599f9750e4936c.zip CMake-3fc7dc5e70cd444731dd3adcc4599f9750e4936c.tar.gz CMake-3fc7dc5e70cd444731dd3adcc4599f9750e4936c.tar.bz2 |
ENH: Move permissions code to kwsys so that copyfile can use it. Fixes Bug #1133 - cmake -E copy file dir sets the wrong permissions on the destination directory
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 379898e..5eef488 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -858,19 +858,13 @@ bool cmSystemTools::DoesFileExistWithExtensions( bool cmSystemTools::cmCopyFile(const char* source, const char* destination) { - mode_t perm = 0; - return cmSystemTools::GetPermissions(source, perm) && - Superclass::CopyFileAlways(source, destination) && - cmSystemTools::SetPermissions(destination, perm); + return Superclass::CopyFileAlways(source, destination); } bool cmSystemTools::CopyFileIfDifferent(const char* source, const char* destination) { - mode_t perm = 0; - return cmSystemTools::GetPermissions(source, perm) && - Superclass::CopyFileIfDifferent(source, destination) && - cmSystemTools::SetPermissions(destination, perm); + return Superclass::CopyFileIfDifferent(source, destination); } void cmSystemTools::Glob(const char *directory, const char *regexp, @@ -1283,36 +1277,3 @@ bool cmSystemTools::PutEnv(const char* value) return ret == 0; } -bool cmSystemTools::GetPermissions(const char* file, mode_t& mode) -{ - if ( !file ) - { - return false; - } - - struct stat st; - if ( stat(file, &st) < 0 ) - { - return false; - } - mode = st.st_mode; - return true; -} - -bool cmSystemTools::SetPermissions(const char* file, mode_t mode) -{ - if ( !file ) - { - return false; - } - if ( !cmSystemTools::FileExists(file) ) - { - return false; - } - if ( chmod(file, mode) < 0 ) - { - return false; - } - - return true; -} |