@@ -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];