diff --git a/mapedit/exult_studio.cc b/mapedit/exult_studio.cc index 59817d22b..b8bad04e1 100644 --- a/mapedit/exult_studio.cc +++ b/mapedit/exult_studio.cc @@ -22,11 +22,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "studio.h" -#ifdef _WIN32 +#if defined(MACOSX) || defined(_WIN32) #include "utils.h" #endif int main(int argc, char **argv) { + +#ifdef MACOSX + // setting up environment for Exult Studio in an app bundle + setup_app_bundle_resource(); + if (is_system_path_defined("")) { + std::string bundle_res = get_system_path(""); + if (U7exists(bundle_res)) { + std::string bundle_share; + std::string bundle_pixbuf; + std::string bundle_im; + bundle_share = bundle_res; + bundle_share += "/share"; + bundle_pixbuf = bundle_res; + bundle_pixbuf += "/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"; + bundle_im = bundle_res; + bundle_im += "/lib/gtk-3.0/3.0.0/immodules.cache"; + const gchar *b_res = bundle_res.c_str(); + const gchar *b_share = bundle_share.c_str(); + const gchar *b_pixbuf= bundle_pixbuf.c_str(); + const gchar *b_im = bundle_im.c_str(); + g_setenv("XDG_DATA_DIRS", b_share, 1); + g_setenv("GTK_DATA_PREFIX", b_res, 1); + g_setenv("GTK_EXE_PREFIX", b_res, 1); + g_setenv("GTK_PATH", b_res, 1); + g_setenv("GDK_PIXBUF_MODULE_FILE", b_pixbuf, 1); + g_setenv("GTK_IM_MODULE_FILE", b_im, 1); + } + } +#endif + ExultStudio studio(argc, argv); studio.run();