1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

OpenCS: proper working dir & library path on OS X

This commit is contained in:
Nikolay Kasyanov 2013-11-10 22:19:32 +04:00
parent fa13818360
commit 96714fc2c1

View file

@ -8,8 +8,8 @@
#include <QIcon> #include <QIcon>
// for Ogre::macBundlePath // for Ogre::macBundlePath
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE #ifdef Q_OS_MAC
#include <OSX/macUtils.h> #include <QDir>
#endif #endif
class Application : public QApplication class Application : public QApplication
@ -37,15 +37,28 @@ class Application : public QApplication
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
// set current dir to bundle path
boost::filesystem::path bundlePath = boost::filesystem::path(Ogre::macBundlePath()).parent_path();
boost::filesystem::current_path(bundlePath);
#endif
Q_INIT_RESOURCE (resources); Q_INIT_RESOURCE (resources);
Application mApplication (argc, argv); Application mApplication (argc, argv);
#ifdef Q_OS_MAC
QDir dir(QCoreApplication::applicationDirPath());
if (dir.dirName() == "MacOS") {
dir.cdUp();
dir.cdUp();
dir.cdUp();
}
QDir::setCurrent(dir.absolutePath());
// force Qt to load only LOCAL plugins, don't touch system Qt installation
QDir pluginsPath(QCoreApplication::applicationDirPath());
pluginsPath.cdUp();
pluginsPath.cd("Plugins");
QStringList libraryPaths;
libraryPaths << pluginsPath.path() << QCoreApplication::applicationDirPath();
mApplication.setLibraryPaths(libraryPaths);
#endif
mApplication.setWindowIcon (QIcon (":./opencs.png")); mApplication.setWindowIcon (QIcon (":./opencs.png"));
CS::Editor editor; CS::Editor editor;