From 0494fa543f99a4f1faef6e13dc54aaaa43dcd28d Mon Sep 17 00:00:00 2001
From: Nikolay Kasyanov <corrmage@gmail.com>
Date: Sun, 10 Nov 2013 20:39:35 +0400
Subject: [PATCH] OpenCS: set current directory to bundle location on OS X,
 like in OpenMW binary

---
 apps/opencs/main.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/apps/opencs/main.cpp b/apps/opencs/main.cpp
index e5e7514ce..76869d0af 100644
--- a/apps/opencs/main.cpp
+++ b/apps/opencs/main.cpp
@@ -7,6 +7,11 @@
 #include <QApplication>
 #include <QIcon>
 
+// for Ogre::macBundlePath
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#include <OSX/macUtils.h>
+#endif
+
 class Application : public QApplication
 {
     private:
@@ -32,6 +37,12 @@ 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);