Merge branch 'upstream-kwsys' into update-kwsys

This commit is contained in:
Brad King 2015-09-26 10:42:35 -04:00
commit 946e861519
2 changed files with 82 additions and 76 deletions

View File

@ -9,7 +9,6 @@
# resulting memory leaks are not logged by valgrind anyway. Therefore, we
# don't have to exclude it.
set(CTEST_CUSTOM_MEMCHECK_IGNORE
${CTEST_CUSTOM_MEMCHECK_IGNORE}
list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
kwsys.testProcess-10
)

View File

@ -2365,14 +2365,20 @@ bool SystemTools::CopyFileAlways(const std::string& source, const std::string& d
}
mode_t perm = 0;
bool perms = SystemTools::GetPermissions(source, perm);
std::string real_destination = destination;
if(SystemTools::FileIsDirectory(source))
{
SystemTools::MakeDirectory(destination);
}
else
{
const int bufferSize = 4096;
char buffer[bufferSize];
// If destination is a directory, try to create a file with the same
// name as the source in that directory.
std::string real_destination = destination;
std::string destination_dir;
if(SystemTools::FileExists(destination) &&
SystemTools::FileIsDirectory(destination))
@ -2455,6 +2461,7 @@ bool SystemTools::CopyFileAlways(const std::string& source, const std::string& d
{
return false;
}
}
if ( perms )
{
if ( !SystemTools::SetPermissions(real_destination, perm) )