aboutsummaryrefslogtreecommitdiff
path: root/libsylph/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r--libsylph/utils.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c
index 474d96a6..1e54ebc5 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -52,6 +52,10 @@
# include <shlobj.h>
#endif
+#ifdef __APPLE__
+# include <AppKit/AppKit.h>
+#endif
+
#include "utils.h"
#include "socket.h"
@@ -2129,6 +2133,21 @@ void set_startup_dir(void)
} else
startup_dir = g_get_current_dir();
}
+#elif defined(__APPLE__)
+ if (!startup_dir) {
+ const gchar *path;
+ NSAutoreleasePool *pool;
+
+ pool = [[NSAutoreleasePool alloc] init];
+
+ path = [[[NSBundle mainBundle] bundlePath] UTF8String];
+ startup_dir = g_strdup(path);
+
+ [pool release];
+
+ if (!startup_dir)
+ startup_dir = g_get_current_dir();
+ }
#else
if (!startup_dir)
startup_dir = g_get_current_dir();