Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/files/utils.cc b/files/utils.cc
- index 784093eae..1df878900 100644
- --- a/files/utils.cc
- +++ b/files/utils.cc
- @@ -872,7 +872,10 @@ void setup_program_paths() {
- U7mkdir("<HOME>", 0755);
- U7mkdir("<CONFIG>", 0755);
- U7mkdir("<SAVEHOME>", 0755);
- +}
- +
- #ifdef MACOSX
- +void setup_appbundle() {
- // setup APPBUNDLE needed to launch Exult Studio from one
- std::unique_ptr<std::remove_pointer<CFURLRef>::type, CFDeleter> fileUrl {std::move(CFBundleCopyBundleURL(CFBundleGetMainBundle()))};
- if (fileUrl) {
- @@ -886,8 +889,8 @@ void setup_program_paths() {
- clear_system_path("<APPBUNDLE>");
- }
- }
- -#endif
- }
- +#endif
- /*
- * Change the current directory
- diff --git a/files/utils.h b/files/utils.h
- index 98a40aeb0..9ed6a96da 100644
- --- a/files/utils.h
- +++ b/files/utils.h
- @@ -455,6 +455,9 @@ void cleanup_output(const char *prefix = "std");
- #endif
- void setup_data_dir(const std::string &data_path, const char *runpath);
- void setup_program_paths();
- +#ifdef MACOSX
- +void setup_appbundle();
- +#endif
- int U7chdir(
- const char *dirname
- diff --git a/mapedit/exult_studio.cc b/mapedit/exult_studio.cc
- index 59817d22b..4fc64a842 100644
- --- a/mapedit/exult_studio.cc
- +++ b/mapedit/exult_studio.cc
- @@ -22,11 +22,44 @@ 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_appbundle();
- + if (is_system_path_defined("<APPBUNDLE>")) {
- + std::string app_path = get_system_path("<APPBUNDLE>");
- + if (U7exists(app_path)) {
- + std::string bundle_res;
- + std::string bundle_data;
- + std::string bundle_pixbuf;
- + std::string bundle_im;
- + bundle_res = app_path;
- + bundle_res += "/Contents/Resources";
- + bundle_data = bundle_res;
- + bundle_data += "/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_data = bundle_data.c_str();
- + const gchar *b_pixbuf= bundle_pixbuf.c_str();
- + const gchar *b_im = bundle_im.c_str();
- + g_setenv("XDG_DATA_DIRS", b_data, 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();
- diff --git a/mapedit/studio.cc b/mapedit/studio.cc
- index 8eca18729..b7f065dd7 100644
- --- a/mapedit/studio.cc
- +++ b/mapedit/studio.cc
- @@ -740,6 +740,7 @@ ExultStudio::ExultStudio(int argc, char **argv): glade_path(nullptr),
- // Setup virtual directories
- string data_path;
- #ifdef MACOSX
- + setup_appbundle();
- string app_path;
- if (is_system_path_defined("<APPBUNDLE>")) {
- app_path = get_system_path("<APPBUNDLE>");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement