From 9ee1ebecf13c44bf4eb987992356c04a7ab08ad4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@digia.com>
Date: Thu, 25 Sep 2014 08:20:01 +0200
Subject: [PATCH] Prevent re-deploying already deployed imports.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Check if the target directory exists before copying
the import.

Change-Id: Id729f26b4b887c7a3b209aa88649eca3fc73b0ba
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
---
 src/macdeployqt/shared/shared.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp
index 3e581a9db..f75f68e7e 100644
--- a/src/macdeployqt/shared/shared.cpp
+++ b/src/macdeployqt/shared/shared.cpp
@@ -828,6 +828,12 @@ void deployPlugins(const QString &appBundlePath, DeploymentInfo deploymentInfo,
 void deployQmlImport(const QString &appBundlePath, const QString &importSourcePath, const QString &importName)
 {
     QString importDestinationPath = appBundlePath + "/Contents/Resources/qml/" + importName;
+
+    // Skip already deployed imports. This can happen in cases like "QtQuick.Controls.Styles",
+    // where deploying QtQuick.Controls will also deploy the "Styles" sub-import.
+    if (QDir().exists(importDestinationPath))
+        return;
+
     recursiveCopyAndDeploy(appBundlePath, importSourcePath, importDestinationPath);
 }
 
-- 
GitLab