ObjFW  Diff

Differences From Artifact [96795739ab]:

  • File src/OFFileManager.m — part of check-in [fe2cbe0021] at 2018-04-22 16:13:04 on branch trunk — runtime: Define BOOL to be the same as bool

    As we define the ABI, we can just replace BOOL with bool everywhere,
    including in ObjFW itself. For the Apple platforms where BOOL and bool
    are different, this is not a problem as BOOL and bool are passed and
    returned the same way in the ABI.

    This still defines BOOL to bool for compatibility, except on AmigaOS and
    Wii, which both have its own BOOL type. (user: js, size: 21906) [annotate] [blame] [check-ins using]

To Artifact [6bf29cf1ec]:


52
53
54
55
56
57
58
59




60
61
62
63
64
65
66

#ifdef OF_WINDOWS
# include <windows.h>
# include <direct.h>
# include <ntdef.h>
#endif

#ifdef OF_MORPHOS




# include <proto/dos.h>
# include <proto/locale.h>
#endif

@interface OFFileManager_default: OFFileManager
@end








|
>
>
>
>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

#ifdef OF_WINDOWS
# include <windows.h>
# include <direct.h>
# include <ntdef.h>
#endif

#ifdef OF_AMIGAOS
# ifdef OF_AMIGAOS3
#  define INTUITION_CLASSES_H
# endif
# include <proto/exec.h>
# include <proto/dos.h>
# include <proto/locale.h>
#endif

@interface OFFileManager_default: OFFileManager
@end

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const of_file_type_t of_file_type_symbolic_link = @"of_file_type_symbolic_link";
const of_file_type_t of_file_type_fifo = @"of_file_type_fifo";
const of_file_type_t of_file_type_character_special =
    @"of_file_type_character_special";
const of_file_type_t of_file_type_block_special = @"of_file_type_block_special";
const of_file_type_t of_file_type_socket = @"of_file_type_socket";

#ifdef OF_MORPHOS
static bool dirChanged = false;
static BPTR originalDirLock = 0;

OF_DESTRUCTOR()
{
	if (dirChanged)
		UnLock(CurrentDir(originalDirLock));







|







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const of_file_type_t of_file_type_symbolic_link = @"of_file_type_symbolic_link";
const of_file_type_t of_file_type_fifo = @"of_file_type_fifo";
const of_file_type_t of_file_type_character_special =
    @"of_file_type_character_special";
const of_file_type_t of_file_type_block_special = @"of_file_type_block_special";
const of_file_type_t of_file_type_socket = @"of_file_type_socket";

#ifdef OF_AMIGAOS
static bool dirChanged = false;
static BPTR originalDirLock = 0;

OF_DESTRUCTOR()
{
	if (dirChanged)
		UnLock(CurrentDir(originalDirLock));
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
	@try {
		ret = [OFString stringWithUTF16String: buffer];
	} @finally {
		free(buffer);
	}

	return ret;
#elif defined(OF_MORPHOS)
	char buffer[512];

	if (!NameFromLock(((struct Process *)FindTask(NULL))->pr_CurrentDir,
	    buffer, 512)) {
		if (IoErr() == ERROR_LINE_TOO_LONG)
			@throw [OFOutOfRangeException exception];








|







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
	@try {
		ret = [OFString stringWithUTF16String: buffer];
	} @finally {
		free(buffer);
	}

	return ret;
#elif defined(OF_AMIGAOS)
	char buffer[512];

	if (!NameFromLock(((struct Process *)FindTask(NULL))->pr_CurrentDir,
	    buffer, 512)) {
		if (IoErr() == ERROR_LINE_TOO_LONG)
			@throw [OFOutOfRangeException exception];

400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
		@throw [OFInvalidArgumentException exception];

#if defined(OF_WINDOWS)
	if (_wchdir([path UTF16String]) != 0)
		@throw [OFChangeCurrentDirectoryPathFailedException
		    exceptionWithPath: path
				errNo: errno];
#elif defined(OF_MORPHOS)
	BPTR lock, oldLock;

	if ((lock = Lock([path cStringWithEncoding: [OFLocalization encoding]],
	    SHARED_LOCK)) == 0) {
		int errNo;

		switch (IoErr()) {







|







404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
		@throw [OFInvalidArgumentException exception];

#if defined(OF_WINDOWS)
	if (_wchdir([path UTF16String]) != 0)
		@throw [OFChangeCurrentDirectoryPathFailedException
		    exceptionWithPath: path
				errNo: errno];
#elif defined(OF_AMIGAOS)
	BPTR lock, oldLock;

	if ((lock = Lock([path cStringWithEncoding: [OFLocalization encoding]],
	    SHARED_LOCK)) == 0) {
		int errNo;

		switch (IoErr()) {