summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-01-10 02:37:55 +0000
committerDavid Robillard <d@drobilla.net>2015-01-10 02:37:55 +0000
commitb608165e9162d2d429de47bbc430ecae136d3455 (patch)
tree0b005b3fe0e638ebcbbedf8ab2a7fdbb07328d83 /src
parent639a935bd7d06a5996ad76f11c6836e20c410c12 (diff)
downloadpatchage-b608165e9162d2d429de47bbc430ecae136d3455.tar.gz
patchage-b608165e9162d2d429de47bbc430ecae136d3455.tar.bz2
patchage-b608165e9162d2d429de47bbc430ecae136d3455.zip
More Mac integration work.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@5510 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0e870b9..81f7ba5 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -28,16 +28,43 @@
#include "Patchage.hpp"
-int
-main(int argc, char** argv)
-{
#ifdef __APPLE__
- 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";
+void
+set_bundle_environment()
+{
+ const std::string binary = binary_location();
+ const std::string bundle = binary.substr(0, binary.find_last_of('/'));
+ const std::string lib_path = bundle + "/lib";
+ if (!Glib::file_test(lib_path, Glib::FILE_TEST_EXISTS)) {
+ // If lib does not exist, we have not been bundleified, do nothing
+ return;
+ }
+
+ setenv("GTK_PATH", lib_path.c_str(), 1);
+ setenv("DYLD_LIBRARY_PATH", lib_path.c_str(), 1);
+
+ const std::string pangorc_path(bundle + "/Resources/pangorc");
+ if (Glib::file_test(pangorc_path, Glib::FILE_TEST_EXISTS)) {
+ setenv("PANGO_RC_FILE", pangorc_path.c_str(), 1);
+ }
+
+ const std::string fonts_conf_path(bundle + "/Resources/fonts.conf");
+ if (Glib::file_test(fonts_conf_path, Glib::FILE_TEST_EXISTS)) {
+ setenv("FONTCONFIG_FILE", fonts_conf_path.c_str(), 1);
+ }
+
+ 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
+
+int
+main(int argc, char** argv)
+{
+#ifdef __APPLE__
+ set_bundle_environment();
#endif
try {