From a6a2f975d6e5095ab57b96984893454a70b621d4 Mon Sep 17 00:00:00 2001 From: gsherman Date: Sat, 12 Jun 2004 19:54:43 +0000 Subject: [PATCH] Added ifdef's for OSX compilation (per J.Collord) git-svn-id: http://svn.osgeo.org/qgis/trunk@1565 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/qgisapp.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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