summaryrefslogtreecommitdiff
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 39873e630d..d27081b8c6 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2186,12 +2186,15 @@ bool SystemTools::CopyFileIfDifferent(const std::string& source,
// FilesDiffer does not handle file to directory compare
if (SystemTools::FileIsDirectory(destination)) {
const std::string new_destination = FileInDir(source, destination);
- return SystemTools::CopyFileIfDifferent(source, new_destination);
- }
- // source and destination are files so do a copy if they
- // are different
- if (SystemTools::FilesDiffer(source, destination)) {
- return SystemTools::CopyFileAlways(source, destination);
+ if (!SystemTools::ComparePath(new_destination, destination)) {
+ return SystemTools::CopyFileIfDifferent(source, new_destination);
+ }
+ } else {
+ // source and destination are files so do a copy if they
+ // are different
+ if (SystemTools::FilesDiffer(source, destination)) {
+ return SystemTools::CopyFileAlways(source, destination);
+ }
}
// at this point the files must be the same so return true
return true;