From 7646fa9d26b362581e7c140ea5ccb87f612c9066 Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 13 Dec 2013 09:24:37 +0000 Subject: set_startup_dir(): OS X: set application bundle directory rather than /. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3316 ee746299-78ed-0310-b773-934348b2243d --- libsylph/Makefile.am | 2 +- libsylph/utils.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'libsylph') diff --git a/libsylph/Makefile.am b/libsylph/Makefile.am index b512d120..8cf0516c 100644 --- a/libsylph/Makefile.am +++ b/libsylph/Makefile.am @@ -4,7 +4,7 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DLOCALEDIR=\""$(localedir)"\" -INCLUDES = -I$(top_srcdir) $(GLIB_CFLAGS) +INCLUDES = -I$(top_srcdir) $(GLIB_CFLAGS) $(LIBSYLPH_CFLAGS) lib_LTLIBRARIES = libsylph-0.la #noinst_LTLIBRARIES = libsylph.la 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 #endif +#ifdef __APPLE__ +# include +#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(); -- cgit v1.2.3