Mac: Add temporary solution to fix app deployment.
authorMorten Johan Sorvig <morten.sorvig@nokia.com>
Tue, 6 Dec 2011 20:09:53 +0000 (21:09 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 22 Dec 2011 01:28:09 +0000 (02:28 +0100)
Look for the the platform plugin in "../Plugins" first.
When deployed inside an app bundle this path will
point to the plugin directory inside the app bundle.

Change-Id: I362981a9e0ca9a3e69396b033a571d0b4e2bf78a
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
src/gui/kernel/qguiapplication.cpp

index 312d8f5..f669a8f 100644 (file)
@@ -334,6 +334,16 @@ void QGuiApplicationPrivate::createPlatformIntegration()
 
     // Load the platform integration
     QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
+
+    // On Mac, look inside the application bundle for the platform plugin.
+    // TODO (msorvig): Create proper cross-platform solution for loading
+    // deployed platform plugins
+#ifdef Q_OS_MAC
+    if (platformPluginPath.isEmpty()) {
+        platformPluginPath = QCoreApplication::applicationDirPath() + QLatin1String("../Plugins/");
+    }
+#endif
+
     QByteArray platformName;
 #ifdef QT_QPA_DEFAULT_PLATFORM_NAME
     platformName = QT_QPA_DEFAULT_PLATFORM_NAME;