ObjFW  Check-in [a006d15fed]

Overview
Comment:OFSystemInfo: Use sysdir.h on macOS 10.12
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a006d15fedcad0e93151d2c85ccc4f1f725f17ccac87c16389230a8339bf2305
User & Date: js on 2016-09-03 22:33:01
Other Links: manifest | tags
Context
2016-09-07
21:15
OFDataArray: Fix a missing underscore check-in: 3519c1e727 user: js tags: trunk
2016-09-03
22:33
OFSystemInfo: Use sysdir.h on macOS 10.12 check-in: a006d15fed user: js tags: trunk
2016-08-29
00:05
configure: Add --disable-unicode-tables option check-in: b7b33247d6 user: js tags: trunk
Changes

Modified configure.ac from [4ea6665d47] to [c4ce7cdd7f].

403
404
405
406
407
408
409

410
411
412
413
414
415
416
417



418
419
420
421
422
423
424

case "$host_os" in
	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"
			])
		])



		;;
esac

AC_C_BIGENDIAN([
	AC_DEFINE(OF_BIG_ENDIAN, 1, [Whether we are big endian])
])
AS_IF([test x"$ac_cv_c_bigendian" = x"universal"], [







>








>
>
>







403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428

case "$host_os" in
	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])
])
AS_IF([test x"$ac_cv_c_bigendian" = x"universal"], [

Modified src/OFSystemInfo.m from [b2e536c6d0] to [35e9a4decf].

37
38
39
40
41
42
43



44

45
46
47
48
49
50
51
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFApplication.h"

#import "OFNotImplementedException.h"

#if defined(OF_MAC_OS_X)



# include <NSSystemDirectories.h>

#endif
#ifdef OF_WINDOWS
# include <windows.h>
#endif
#ifdef OF_HAIKU
# include <FindDirectory.h>
#endif







>
>
>
|
>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFApplication.h"

#import "OFNotImplementedException.h"

#if defined(OF_MAC_OS_X)
# ifdef HAVE_SYSDIR_H
#  include <sysdir.h>
# else
#  include <NSSystemDirectories.h>
# endif
#endif
#ifdef OF_WINDOWS
# include <windows.h>
#endif
#ifdef OF_HAIKU
# include <FindDirectory.h>
#endif
147
148
149
150
151
152
153
154
155
156











157
158
159
160
161
162

163
164
165
166
167
168
169

+ (OFString*)userDataPath
{
	/* 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;












	state = NSStartSearchPathEnumeration(NSApplicationSupportDirectory,
	    NSUserDomainMask);
	if (NSGetNextSearchPathEnumeration(state, pathC) == 0)
		@throw [OFNotImplementedException exceptionWithSelector: _cmd
								 object: self];


	path = [OFMutableString stringWithUTF8String: pathC];
	if ([path hasPrefix: @"~"]) {
		OFDictionary *env = [OFApplication environment];

		if ((home = [env objectForKey: @"HOME"]) == nil)
			@throw [OFNotImplementedException







<


>
>
>
>
>
>
>
>
>
>
>






>







151
152
153
154
155
156
157

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184

+ (OFString*)userDataPath
{
	/* TODO: Return something more sensible for iOS */
#if defined(OF_MAC_OS_X)
	void *pool = objc_autoreleasePoolPush();
	char pathC[PATH_MAX];

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

		if ((home = [env objectForKey: @"HOME"]) == nil)
			@throw [OFNotImplementedException
227
228
229
230
231
232
233
234
235
236











237
238
239
240
241
242

243
244
245
246
247
248
249

+ (OFString*)userConfigPath
{
	/* 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;












	state = NSStartSearchPathEnumeration(NSLibraryDirectory,
	    NSUserDomainMask);
	if (NSGetNextSearchPathEnumeration(state, pathC) == 0)
		@throw [OFNotImplementedException exceptionWithSelector: _cmd
								 object: self];


	path = [OFMutableString stringWithUTF8String: pathC];
	if ([path hasPrefix: @"~"]) {
		OFDictionary *env = [OFApplication environment];

		if ((home = [env objectForKey: @"HOME"]) == nil)
			@throw [OFNotImplementedException







<


>
>
>
>
>
>
>
>
>
>
>






>







242
243
244
245
246
247
248

249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

+ (OFString*)userConfigPath
{
	/* TODO: Return something more sensible for iOS */
#if defined(OF_MAC_OS_X)
	void *pool = objc_autoreleasePoolPush();
	char pathC[PATH_MAX];

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

		if ((home = [env objectForKey: @"HOME"]) == nil)
			@throw [OFNotImplementedException