diff --git a/apps/opencs/main.cpp b/apps/opencs/main.cpp index 76869d0af..1a3f63c4b 100644 --- a/apps/opencs/main.cpp +++ b/apps/opencs/main.cpp @@ -8,8 +8,8 @@ #include // for Ogre::macBundlePath -#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE -#include +#ifdef Q_OS_MAC +#include #endif class Application : public QApplication @@ -37,15 +37,28 @@ class Application : public QApplication 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); 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")); CS::Editor editor;