diff --git a/src/qgisapp.cpp b/src/qgisapp.cpp index 5b1a81ce134..2199089f833 100644 --- a/src/qgisapp.cpp +++ b/src/qgisapp.cpp @@ -21,6 +21,11 @@ #ifndef WIN32 #include #endif + +#ifdef Q_OS_MACX +#import +#endif + #include #include #include @@ -363,8 +368,24 @@ QgisApp::QgisApp(QWidget * parent, const char *name, WFlags fl):QgisAppBase(pare #else mAppDir = PREFIX; #endif + // Get pointer to the provider registry singleton +#ifdef Q_OS_MACX + // we do different things for OSX - set both application dir and plugin lib + // location here: + CFURLRef pprefixRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFStringRef mmacPath = CFURLCopyFileSystemPath(pprefixRef, kCFURLPOSIXPathStyle); + // store application dir + mAppDir = CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding()); + mAppDir = mAppDir + "/Contents/Resources"; + // store location of plugins + plib = CFStringGetCStringPtr(mmacPath, CFStringGetSystemEncoding()); + plib = plib + "/Contents/Resources/lib"; +#else + // win32 and posix plugin path: QString plib = PLUGINPATH; +#endif + mProviderRegistry = QgsProviderRegistry::instance(plib); #ifdef QGISDEBUG