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 # resulting memory leaks are not logged by valgrind anyway. Therefore, we
# don't have to exclude it. # don't have to exclude it.
set(CTEST_CUSTOM_MEMCHECK_IGNORE list(APPEND CTEST_CUSTOM_MEMCHECK_IGNORE
${CTEST_CUSTOM_MEMCHECK_IGNORE}
kwsys.testProcess-10 kwsys.testProcess-10
) )

View File

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