|
|
@@ -1611,7 +1611,8 @@ kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path)
|
|
|
}
|
|
|
|
|
|
bool SystemTools::CopyFileIfDifferent(const char* source,
|
|
|
- const char* destination)
|
|
|
+ const char* destination,
|
|
|
+ bool copyPermissions)
|
|
|
{
|
|
|
// special check for a destination that is a directory
|
|
|
// FilesDiffer does not handle file to directory compare
|
|
|
@@ -1624,7 +1625,8 @@ bool SystemTools::CopyFileIfDifferent(const char* source,
|
|
|
new_destination += SystemTools::GetFilenameName(source_name);
|
|
|
if(SystemTools::FilesDiffer(source, new_destination.c_str()))
|
|
|
{
|
|
|
- return SystemTools::CopyFileAlways(source, destination);
|
|
|
+ return SystemTools::CopyFileAlways(source, destination,
|
|
|
+ copyPermissions);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1637,7 +1639,7 @@ bool SystemTools::CopyFileIfDifferent(const char* source,
|
|
|
// are different
|
|
|
if(SystemTools::FilesDiffer(source, destination))
|
|
|
{
|
|
|
- return SystemTools::CopyFileAlways(source, destination);
|
|
|
+ return SystemTools::CopyFileAlways(source, destination, copyPermissions);
|
|
|
}
|
|
|
// at this point the files must be the same so return true
|
|
|
return true;
|
|
|
@@ -1718,10 +1720,12 @@ bool SystemTools::FilesDiffer(const char* source,
|
|
|
}
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
/**
|
|
|
* Copy a file named by "source" to the file named by "destination".
|
|
|
*/
|
|
|
-bool SystemTools::CopyFileAlways(const char* source, const char* destination)
|
|
|
+bool SystemTools::CopyFileAlways(const char* source, const char* destination,
|
|
|
+ bool copyPermissions)
|
|
|
{
|
|
|
// If files are the same do not copy
|
|
|
if ( SystemTools::SameFile(source, destination) )
|
|
|
@@ -1824,7 +1828,7 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
- if ( perms )
|
|
|
+ if ( copyPermissions && perms )
|
|
|
{
|
|
|
if ( !SystemTools::SetPermissions(destination, perm) )
|
|
|
{
|
|
|
@@ -1836,15 +1840,15 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
bool SystemTools::CopyAFile(const char* source, const char* destination,
|
|
|
- bool always)
|
|
|
+ bool always, bool copyPermissions)
|
|
|
{
|
|
|
if(always)
|
|
|
{
|
|
|
- return SystemTools::CopyFileAlways(source, destination);
|
|
|
+ return SystemTools::CopyFileAlways(source, destination, copyPermissions);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return SystemTools::CopyFileIfDifferent(source, destination);
|
|
|
+ return SystemTools::CopyFileIfDifferent(source, destination, copyPermissions);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1853,7 +1857,7 @@ bool SystemTools::CopyAFile(const char* source, const char* destination,
|
|
|
* "destination".
|
|
|
*/
|
|
|
bool SystemTools::CopyADirectory(const char* source, const char* destination,
|
|
|
- bool always)
|
|
|
+ bool always, bool copyPermissions)
|
|
|
{
|
|
|
Directory dir;
|
|
|
dir.Load(source);
|
|
|
@@ -1877,14 +1881,16 @@ bool SystemTools::CopyADirectory(const char* source, const char* destination,
|
|
|
fullDestPath += dir.GetFile(static_cast<unsigned long>(fileNum));
|
|
|
if (!SystemTools::CopyADirectory(fullPath.c_str(),
|
|
|
fullDestPath.c_str(),
|
|
|
- always))
|
|
|
+ always,
|
|
|
+ copyPermissions))
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(!SystemTools::CopyAFile(fullPath.c_str(), destination, always))
|
|
|
+ if(!SystemTools::CopyAFile(fullPath.c_str(), destination, always,
|
|
|
+ copyPermissions))
|
|
|
{
|
|
|
return false;
|
|
|
}
|