Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -405,18 +405,22 @@ darwin*) AC_SUBST(LDFLAGS_REEXPORT, ["-Wl,-reexport-lobjfw"]) AS_IF([test x"$objc_runtime" = x"Apple runtime"], [ AC_SUBST(REEXPORT_LIBOBJC, ["-Wl,-reexport-lobjc"]) ]) + AS_IF([test x"$objc_runtime" = x"ObjFW runtime"], [ AS_IF([test x"$exception_type" = x"DWARF"], [ LDFLAGS="$LDFLAGS -Wl,-U,___gxx_personality_v0" ]) AS_IF([test x"$exception_type" = x"SjLj"], [ LDFLAGS="$LDFLAGS -Wl,-U,___gxx_personality_sj0" ]) ]) + + AC_CHECK_HEADERS(sysdir.h) + AC_CHECK_FUNCS(sysdir_start_search_path_enumeration) ;; esac AC_C_BIGENDIAN([ AC_DEFINE(OF_BIG_ENDIAN, 1, [Whether we are big endian]) Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -39,11 +39,15 @@ #import "OFApplication.h" #import "OFNotImplementedException.h" #if defined(OF_MAC_OS_X) -# include +# ifdef HAVE_SYSDIR_H +# include +# else +# include +# endif #endif #ifdef OF_WINDOWS # include #endif #ifdef OF_HAIKU @@ -149,19 +153,30 @@ { /* TODO: Return something more sensible for iOS */ #if defined(OF_MAC_OS_X) void *pool = objc_autoreleasePoolPush(); char pathC[PATH_MAX]; - NSSearchPathEnumerationState state; OFMutableString *path; OFString *home; + +# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION + sysdir_search_path_enumeration_state state; + + state = sysdir_start_search_path_enumeration( + SYSDIR_DIRECTORY_APPLICATION_SUPPORT, SYSDIR_DOMAIN_MASK_USER); + if (sysdir_get_next_search_path_enumeration(state, pathC) == 0) + @throw [OFNotImplementedException exceptionWithSelector: _cmd + object: self]; +# else + NSSearchPathEnumerationState state; state = NSStartSearchPathEnumeration(NSApplicationSupportDirectory, NSUserDomainMask); if (NSGetNextSearchPathEnumeration(state, pathC) == 0) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; +# endif path = [OFMutableString stringWithUTF8String: pathC]; if ([path hasPrefix: @"~"]) { OFDictionary *env = [OFApplication environment]; @@ -229,19 +244,30 @@ { /* TODO: Return something more sensible for iOS */ #if defined(OF_MAC_OS_X) void *pool = objc_autoreleasePoolPush(); char pathC[PATH_MAX]; - NSSearchPathEnumerationState state; OFMutableString *path; OFString *home; + +# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION + sysdir_search_path_enumeration_state state; + + state = sysdir_start_search_path_enumeration( + SYSDIR_DIRECTORY_LIBRARY, SYSDIR_DOMAIN_MASK_USER); + if (sysdir_get_next_search_path_enumeration(state, pathC) == 0) + @throw [OFNotImplementedException exceptionWithSelector: _cmd + object: self]; +# else + NSSearchPathEnumerationState state; state = NSStartSearchPathEnumeration(NSLibraryDirectory, NSUserDomainMask); if (NSGetNextSearchPathEnumeration(state, pathC) == 0) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; +# endif path = [OFMutableString stringWithUTF8String: pathC]; if ([path hasPrefix: @"~"]) { OFDictionary *env = [OFApplication environment];