aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-12-13 09:24:37 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-12-13 09:24:37 +0000
commit7646fa9d26b362581e7c140ea5ccb87f612c9066 (patch)
treed3e56e69a0f4ea6c2241d18c3945575b2b514eab
parent7369bebad1a924e7a4036368ae9274c1ce5fd3af (diff)
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
-rw-r--r--ChangeLog7
-rw-r--r--configure.in3
-rw-r--r--libsylph/Makefile.am2
-rw-r--r--libsylph/utils.c19
4 files changed, 30 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 18212d21..f220373c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-12-13
+
+ * libsylph/utils.c: set_startup_dir(): OS X: set application bundle
+ directory rather than /.
+ * configure.in
+ libsylph/Makefile.am: OS X: added -xobjective-c option.
+
2013-11-29
* version 3.4.0beta7
diff --git a/configure.in b/configure.in
index dcb6b48c..1756bc9f 100644
--- a/configure.in
+++ b/configure.in
@@ -78,6 +78,7 @@ native_win32=no
case "$target" in
*-darwin*)
CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
+ LIBSYLPH_CFLAGS="$LIBSYLPH_CFLAGS -xobjective-c"
;;
*-*-mingw*)
native_win32=yes
@@ -87,6 +88,8 @@ case "$target" in
;;
esac
+AC_SUBST(LIBSYLPH_CFLAGS)
+
AM_CONDITIONAL(NATIVE_WIN32, test "$native_win32" = "yes")
dnl Checks for libraries.
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 <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();