[PATCH] Start kdevelop on OS X

Maximilian Kossick maximilian.kossick at googlemail.com
Wed Jan 20 19:21:05 UTC 2010


Hi,

on OS X kdevelop and kdev_starter are both installed as application
bundles. The patch below adds the code that is required to start
kdev_starter from kdevelop. Using that patch kdevelop actually starts
when clicking the icon.

The patch assumes that kdevelop.app and kdev_starter.app (the
application bundles for those applications, which are actually just
directories with a special .app suffix) are in the same directory.

Cheers,
Max


ndex: app/main.cpp
===================================================================
--- app/main.cpp        (Revision 1077684)
+++ app/main.cpp        (Arbeitskopie)
@@ -145,9 +145,31 @@
        //Forward all arguments, the session will be skipped
automatically as KDEV_SESSION will be set
        for(uint a = 1; a < argc; ++a)
            args << QString(argv[a]);
+
+        #ifdef Q_WS_MAC
+        //if kdevelop is installed as app bundle on OS X we have to
start kdev_start from the application bundle as well
+        //the actual executable can be found in the Contents/MacOS
subdirectory of the app bundle
+        QString kdevStarter;
+        //use CaseInsensitive so it will not break when somebody
decides to rename kdevelop to KDevelop on OS X
+        if( QApplication::applicationFilePath().endsWith(
"kdevelop.app/Contents/MacOS/kdevelop", Qt::CaseInsensitive ) )
+        {
+            QFileInfo fi( QApplication::applicationFilePath() );
+            QDir dir = fi.dir();
+            dir.cdUp(); //in kdevelop.app/Contents
+            dir.cdUp(); //in kdevelop.app
+            dir.cdUp();
+            kdevStarter = dir.path() +
"/kdev_starter.app/Contents/MacOS/kdev_starter";
+        }
+        else
+        {
+            kdevStarter =
QFileInfo(QApplication::applicationFilePath()).path() +
"/kdev_starter";
+        }
+        #else
+        QString kdevStarter =
QFileInfo(QApplication::applicationFilePath()).path() +
"/kdev_starter";
+        #endif

        //@todo Eventually show a session-picking dialog
-        KProcess::startDetached(QFileInfo(QApplication::applicationFilePath()).path()
+ "/kdev_starter", args);
+        KProcess::startDetached( kdevStarter, args);
        return 0;
    }




More information about the KDevelop-devel mailing list