From d01403a306390081bba5b7d4fc782e1e2c6b70cc Mon Sep 17 00:00:00 2001
From: Alessandro Portale <alessandro.portale@nokia.com>
Date: Mon, 2 Aug 2010 21:24:33 +0200
Subject: [PATCH] Fixed the data deployment on OSX

Switchen from QMAKE_BUNDLE_DATA to QMAKE_EXTRA_TARGETS, like we
already do on Windows and Linux.
QMAKE_BUNDLE_DATA does not seem to create make targets. We need
to copy-if-changed the files into the resources folder on each run.

Also pushed the Resources/ folder one level deeper, into Contents/.
---
 .../wizards/templates/app.pro                  | 18 +++++++++++-------
 .../templates/cpp/qmlapplicationview.cpp       |  2 +-
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/plugins/qmlprojectmanager/wizards/templates/app.pro b/src/plugins/qmlprojectmanager/wizards/templates/app.pro
index c22d2afc2c9..5a7b728ff43 100644
--- a/src/plugins/qmlprojectmanager/wizards/templates/app.pro
+++ b/src/plugins/qmlprojectmanager/wizards/templates/app.pro
@@ -67,13 +67,17 @@ symbian {
     target.path = /opt/bin
     INSTALLS += target
 } else:macx {
-    for(deploymentfolder, DEPLOYMENTFOLDERS) {
-        item = item$${deploymentfolder}
-        itemsources = $${item}.files
-        $$itemsources = $$eval($${deploymentfolder}.source)
-        itempath = $${item}.path
-        $$itempath = Resources/$$eval($${deploymentfolder}.target)
-        QMAKE_BUNDLE_DATA += $$item
+    !isEqual(PWD,$$OUT_PWD) {
+        copyCommand = @echo Copying application data...
+        for(deploymentfolder, DEPLOYMENTFOLDERS) {
+            target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
+            copyCommand += && $(MKDIR) $$target
+            copyCommand += && $(COPY_DIR) $$PWD/$$eval($${deploymentfolder}.source) $$target
+        }
+        copydeploymentfolders.commands = $$copyCommand
+        first.depends = $(first) copydeploymentfolders
+        QMAKE_EXTRA_TARGETS += first copydeploymentfolders
+message($$copyCommand)
     }
 } else { #linux
     !isEqual(PWD,$$OUT_PWD) {
diff --git a/src/plugins/qmlprojectmanager/wizards/templates/cpp/qmlapplicationview.cpp b/src/plugins/qmlprojectmanager/wizards/templates/cpp/qmlapplicationview.cpp
index d9a24eebfb3..2d0f505acc3 100644
--- a/src/plugins/qmlprojectmanager/wizards/templates/cpp/qmlapplicationview.cpp
+++ b/src/plugins/qmlprojectmanager/wizards/templates/cpp/qmlapplicationview.cpp
@@ -26,7 +26,7 @@ QmlApplicationView::QmlApplicationView(const QString &mainQmlFile, QWidget *pare
 {
 #ifdef Q_OS_MAC
     m_d->mainQmlFile = QCoreApplication::applicationDirPath()
-            + QLatin1String("/../../Resources/") + mainQmlFile;
+            + QLatin1String("/../Resources/") + mainQmlFile;
 #else
     m_d->mainQmlFile = mainQmlFile;
 #endif
-- 
GitLab