Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/MarbleDirs.cpp
Show All 24 Lines | |||||
25 | 25 | | |||
26 | #ifdef Q_OS_WIN | 26 | #ifdef Q_OS_WIN | ||
27 | //for getting appdata path | 27 | //for getting appdata path | ||
28 | //mingw-w64 Internet Explorer 5.01 | 28 | //mingw-w64 Internet Explorer 5.01 | ||
29 | #define _WIN32_IE 0x0501 | 29 | #define _WIN32_IE 0x0501 | ||
30 | #include <shlobj.h> | 30 | #include <shlobj.h> | ||
31 | #endif | 31 | #endif | ||
32 | 32 | | |||
33 | #ifdef Q_OS_MACX | 33 | #ifdef APPLE_STANDALONE_BUNDLE | ||
34 | //for getting app bundle path | 34 | //for getting app bundle path | ||
35 | #include <ApplicationServices/ApplicationServices.h> | 35 | #include <ApplicationServices/ApplicationServices.h> | ||
36 | #endif | 36 | #endif | ||
37 | 37 | | |||
38 | #include <config-marble.h> | 38 | #include <config-marble.h> | ||
39 | 39 | | |||
40 | using namespace Marble; | 40 | using namespace Marble; | ||
41 | 41 | | |||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 123 | { | |||
126 | } | 126 | } | ||
127 | 127 | | |||
128 | QString systempath; | 128 | QString systempath; | ||
129 | 129 | | |||
130 | #ifdef Q_OS_WIN | 130 | #ifdef Q_OS_WIN | ||
131 | return QCoreApplication::applicationDirPath() + QDir::separator() + QLatin1String("data"); | 131 | return QCoreApplication::applicationDirPath() + QDir::separator() + QLatin1String("data"); | ||
132 | #endif | 132 | #endif | ||
133 | 133 | | |||
134 | #ifdef Q_OS_MACX | 134 | #ifdef APPLE_STANDALONE_BUNDLE | ||
135 | // | 135 | // | ||
136 | // On OSX lets try to find any file first in the bundle | 136 | // On OSX lets try to find any file first in the bundle | ||
137 | // before branching out to home and sys dirs | 137 | // before branching out to home and sys dirs | ||
138 | // | 138 | // | ||
139 | CFURLRef myBundleRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); | 139 | CFURLRef myBundleRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); | ||
140 | CFStringRef myMacPath = CFURLCopyFileSystemPath(myBundleRef, kCFURLPOSIXPathStyle); | 140 | CFStringRef myMacPath = CFURLCopyFileSystemPath(myBundleRef, kCFURLPOSIXPathStyle); | ||
141 | const char *mypPathPtr = CFStringGetCStringPtr(myMacPath,CFStringGetSystemEncoding()); | 141 | const char *mypPathPtr = CFStringGetCStringPtr(myMacPath,CFStringGetSystemEncoding()); | ||
142 | CFRelease(myBundleRef); | 142 | CFRelease(myBundleRef); | ||
143 | QString myPath(mypPathPtr); | 143 | QString myPath(mypPathPtr); | ||
144 | CFRelease(myMacPath); | 144 | CFRelease(myMacPath); | ||
145 | //do some magick so that we can still find data dir if | 145 | //do some magick so that we can still find data dir if | ||
146 | //marble was not built as a bundle | 146 | //marble was not built as a bundle | ||
147 | if (myPath.contains(QLatin1String(".app"))) { //its a bundle! | 147 | if (myPath.contains(QLatin1String(".app"))) { //it's a bundle! | ||
148 | systempath = myPath + QLatin1String("/Contents/Resources/data"); | 148 | systempath = myPath + QLatin1String("/Contents/Resources"); | ||
149 | } | 149 | } | ||
150 | 150 | | |||
151 | if ( QFile::exists( systempath ) ){ | 151 | if ( QFile::exists( systempath ) ){ | ||
152 | return systempath; | 152 | return systempath; | ||
153 | } | 153 | } | ||
154 | #endif // mac bundle | 154 | #endif // mac bundle | ||
155 | 155 | | |||
156 | #ifdef Q_OS_ANDROID | 156 | #ifdef Q_OS_ANDROID | ||
Show All 23 Lines | |||||
180 | QString MarbleDirs::pluginSystemPath() | 180 | QString MarbleDirs::pluginSystemPath() | ||
181 | { | 181 | { | ||
182 | if (!runTimeMarblePluginPath.isEmpty()) { | 182 | if (!runTimeMarblePluginPath.isEmpty()) { | ||
183 | return runTimeMarblePluginPath; | 183 | return runTimeMarblePluginPath; | ||
184 | } | 184 | } | ||
185 | 185 | | |||
186 | QString systempath; | 186 | QString systempath; | ||
187 | 187 | | |||
188 | #ifdef Q_OS_MACX | 188 | #ifdef APPLE_STANDALONE_BUNDLE | ||
189 | // | 189 | // | ||
190 | // On OSX lets try to find any file first in the bundle | 190 | // On OSX lets try to find any file first in the bundle | ||
191 | // before branching out to home and sys dirs | 191 | // before branching out to home and sys dirs | ||
192 | // | 192 | // | ||
193 | CFURLRef myBundleRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); | 193 | CFURLRef myBundleRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); | ||
194 | CFStringRef myMacPath = CFURLCopyFileSystemPath(myBundleRef, kCFURLPOSIXPathStyle); | 194 | CFStringRef myMacPath = CFURLCopyFileSystemPath(myBundleRef, kCFURLPOSIXPathStyle); | ||
195 | const char *mypPathPtr = CFStringGetCStringPtr(myMacPath,CFStringGetSystemEncoding()); | 195 | const char *mypPathPtr = CFStringGetCStringPtr(myMacPath,CFStringGetSystemEncoding()); | ||
196 | CFRelease(myBundleRef); | 196 | CFRelease(myBundleRef); | ||
▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines |