summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-01-09 20:05:06 +0000
committerDavid Robillard <d@drobilla.net>2015-01-09 20:05:06 +0000
commit4067bd81444736ddd7047210e2afdaaf9eaeaf40 (patch)
tree5cd70895cc5f4247996c321e044dfec7d063e9c7 /src/main.cpp
parent1dff3fea90f2dc43a8bfc782eb88512344c1b5ae (diff)
downloadpatchage-4067bd81444736ddd7047210e2afdaaf9eaeaf40.tar.gz
patchage-4067bd81444736ddd7047210e2afdaaf9eaeaf40.tar.bz2
patchage-4067bd81444736ddd7047210e2afdaaf9eaeaf40.zip
Fix OSX integration.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@5504 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp38
1 files changed, 6 insertions, 32 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b9e0bb3..0e870b9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -28,42 +28,16 @@
#include "Patchage.hpp"
-#ifdef __APPLE__
-void
-set_bundle_environment()
-{
- char* binloc_c = binary_location();
- std::string binloc(binloc_c);
- free(binloc_c);
-
- const std::string bundle_path = binloc.substr(0, binloc.find_last_of('/'));
-
- const std::string lib_path(bundle_path + "/lib");
- setenv("GTK_PATH", lib_path.c_str(), 1);
- setenv("DYLD_LIBRARY_PATH", lib_path.c_str(), 1);
-
- chdir(bundle_path.c_str());
- const std::string pangorc_path(bundle_path + "/Resources/pangorc");
- setenv("PANGO_RC_FILE", pangorc_path.c_str(), 1);
-
- const std::string fonts_conf_path(bundle_path + "/Resources/fonts.conf");
- setenv("FONTCONFIG_FILE", fonts_conf_path.c_str(), 1);
-
- const char* path_c = getenv("PATH");
- std::string path = "/opt/local/bin";
- if (path_c)
- path += std::string(":") + path_c;
- setenv("PATH", path.c_str(), 1);
-
- gtk_rc_parse((bundle_path + "/Resources/gtkrc").c_str());
-}
-#endif
-
int
main(int argc, char** argv)
{
#ifdef __APPLE__
- set_bundle_environment();
+ const std::string binary = binary_location();
+ const std::string bundle = binary.substr(0, binary.find_last_of('/'));
+ const std::string gtkrc_path = bundle + "/Resources/gtkrc";
+ if (Glib::file_test(gtkrc_path, Glib::FILE_TEST_EXISTS)) {
+ gtk_rc_parse(gtkrc_path.c_str());
+ }
#endif
try {