From fa39d31461d5394870742e4d93843fb5e861934e Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Thu, 26 Feb 2009 16:19:05 +0100
Subject: [PATCH] optimize GdbMacrosBuildStep: don't copy files which are
 already current

---
 .../qt4projectmanager/gdbmacrosbuildstep.cpp      | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp b/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp
index be0804b7cff..c94a2bca0cf 100644
--- a/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp
+++ b/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp
@@ -37,6 +37,8 @@
 #include <coreplugin/icore.h>
 #include <utils/qtcassert.h>
 
+#include <QFileInfo>
+
 using namespace Qt4ProjectManager;
 using namespace Qt4ProjectManager::Internal;
 
@@ -72,10 +74,15 @@ void GdbMacrosBuildStep::run(QFutureInterface<bool> & fi)
         QDir dir;
         dir.mkpath(destDir);
         foreach (const QString &file, files) {
-            QFile destination(destDir + file);
-            if (destination.exists())
-                destination.remove();
-            QFile::copy(dumperPath + file, destDir + file);
+            QString source = dumperPath + file;
+            QString dest = destDir + file;
+            QFileInfo destInfo(dest);
+            if (destInfo.exists()) {
+                if (destInfo.lastModified() >= QFileInfo(source).lastModified())
+                    continue;
+                QFile::remove(dest);
+            }
+            QFile::copy(source, dest);
         }
 
         Qt4Project *qt4Project = static_cast<Qt4Project *>(project());
-- 
GitLab