ObjFW  Check-in [b83abbf019]

Overview
Comment:OFChangeCurrentDirectory{Path ->}FailedException
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b83abbf019057befee97b188c17a4d78556b2ccd01e4c487230645601815e4cc
User & Date: js on 2022-09-25 14:03:41
Other Links: manifest | tags
Context
2022-09-25
15:39
Document more exceptions check-in: 7ab0c2561a user: js tags: trunk
14:03
OFChangeCurrentDirectory{Path ->}FailedException check-in: b83abbf019 user: js tags: trunk
14:00
OF{Retrieve -> Get}ItemAttributesFailedException check-in: 78032c89cb user: js tags: trunk
Changes

Modified src/OFFileManager.m from [f4ba9689b3] to [2c5d56a419].

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#import "OFNumber.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFSystemInfo.h"
#import "OFURL.h"
#import "OFURLHandler.h"

#import "OFChangeCurrentDirectoryPathFailedException.h"
#import "OFCopyItemFailedException.h"
#import "OFCreateDirectoryFailedException.h"
#import "OFGetCurrentDirectoryFailedException.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFMoveItemFailedException.h"
#import "OFNotImplementedException.h"







|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#import "OFNumber.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFSystemInfo.h"
#import "OFURL.h"
#import "OFURLHandler.h"

#import "OFChangeCurrentDirectoryFailedException.h"
#import "OFCopyItemFailedException.h"
#import "OFCreateDirectoryFailedException.h"
#import "OFGetCurrentDirectoryFailedException.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFMoveItemFailedException.h"
#import "OFNotImplementedException.h"
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
			errNo = ENOENT;
			break;
		default:
			errNo = 0;
			break;
		}

		@throw [OFChangeCurrentDirectoryPathFailedException
		    exceptionWithPath: path
				errNo: errNo];
	}

	oldLock = CurrentDir(lock);

	if (!dirChanged)







|







511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
			errNo = ENOENT;
			break;
		default:
			errNo = 0;
			break;
		}

		@throw [OFChangeCurrentDirectoryFailedException
		    exceptionWithPath: path
				errNo: errNo];
	}

	oldLock = CurrentDir(lock);

	if (!dirChanged)
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
		status = _wchdir(path.UTF16String);
	else
#  endif
		status = chdir(
		    [path cStringWithEncoding: [OFLocale encoding]]);

	if (status != 0)
		@throw [OFChangeCurrentDirectoryPathFailedException
		    exceptionWithPath: path
				errNo: errno];
# endif
}

- (void)changeCurrentDirectoryURL: (OFURL *)URL
{







|







536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
		status = _wchdir(path.UTF16String);
	else
#  endif
		status = chdir(
		    [path cStringWithEncoding: [OFLocale encoding]]);

	if (status != 0)
		@throw [OFChangeCurrentDirectoryFailedException
		    exceptionWithPath: path
				errNo: errno];
# endif
}

- (void)changeCurrentDirectoryURL: (OFURL *)URL
{

Modified src/ObjFW.h from [fe9eaa61f8] to [9fdc7f998d].

146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#import "OFAllocFailedException.h"
#import "OFException.h"
#ifdef OF_HAVE_SOCKETS
# import "OFAcceptFailedException.h"
# import "OFAlreadyConnectedException.h"
# import "OFBindFailedException.h"
#endif
#import "OFChangeCurrentDirectoryPathFailedException.h"
#import "OFChecksumMismatchException.h"
#ifdef OF_HAVE_THREADS
# import "OFConditionBroadcastFailedException.h"
# import "OFConditionSignalFailedException.h"
# import "OFConditionStillWaitingException.h"
# import "OFConditionWaitFailedException.h"
#endif







|







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#import "OFAllocFailedException.h"
#import "OFException.h"
#ifdef OF_HAVE_SOCKETS
# import "OFAcceptFailedException.h"
# import "OFAlreadyConnectedException.h"
# import "OFBindFailedException.h"
#endif
#import "OFChangeCurrentDirectoryFailedException.h"
#import "OFChecksumMismatchException.h"
#ifdef OF_HAVE_THREADS
# import "OFConditionBroadcastFailedException.h"
# import "OFConditionSignalFailedException.h"
# import "OFConditionStillWaitingException.h"
# import "OFConditionWaitFailedException.h"
#endif

Modified src/exceptions/Makefile from [08f134bbe5] to [a8a6570db6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
include ../../extra.mk

STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A}
STATIC_LIB_NOINST = ${EXCEPTIONS_A}

SRCS = OFAllocFailedException.m				\
       OFChangeCurrentDirectoryPathFailedException.m	\
       OFChecksumMismatchException.m			\
       OFCopyItemFailedException.m			\
       OFCreateDirectoryFailedException.m		\
       OFCreateSymbolicLinkFailedException.m		\
       OFEnumerationMutationException.m			\
       OFException.m					\
       OFGetItemAttributesFailedException.m		\






<







1
2
3
4
5
6

7
8
9
10
11
12
13
include ../../extra.mk

STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A}
STATIC_LIB_NOINST = ${EXCEPTIONS_A}

SRCS = OFAllocFailedException.m				\

       OFChecksumMismatchException.m			\
       OFCopyItemFailedException.m			\
       OFCreateDirectoryFailedException.m		\
       OFCreateSymbolicLinkFailedException.m		\
       OFEnumerationMutationException.m			\
       OFException.m					\
       OFGetItemAttributesFailedException.m		\
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
       OFUnsupportedVersionException.m			\
       OFWriteFailedException.m				\
       ${USE_SRCS_FILES}				\
       ${USE_SRCS_PLUGINS}				\
       ${USE_SRCS_SOCKETS}				\
       ${USE_SRCS_THREADS}				\
       ${USE_SRCS_WINDOWS}

SRCS_FILES = OFGetCurrentDirectoryFailedException.m
SRCS_PLUGINS = OFLoadPluginFailedException.m
SRCS_SOCKETS = OFAcceptFailedException.m		\
	       OFAlreadyConnectedException.m		\
	       OFBindFailedException.m			\
	       OFConnectionFailedException.m		\
	       OFDNSQueryFailedException.m		\
	       OFHTTPRequestFailedException.m		\







>
|







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
       OFUnsupportedVersionException.m			\
       OFWriteFailedException.m				\
       ${USE_SRCS_FILES}				\
       ${USE_SRCS_PLUGINS}				\
       ${USE_SRCS_SOCKETS}				\
       ${USE_SRCS_THREADS}				\
       ${USE_SRCS_WINDOWS}
SRCS_FILES = OFChangeCurrentDirectoryFailedException.m	\
	     OFGetCurrentDirectoryFailedException.m
SRCS_PLUGINS = OFLoadPluginFailedException.m
SRCS_SOCKETS = OFAcceptFailedException.m		\
	       OFAlreadyConnectedException.m		\
	       OFBindFailedException.m			\
	       OFConnectionFailedException.m		\
	       OFDNSQueryFailedException.m		\
	       OFHTTPRequestFailedException.m		\

Renamed and modified src/exceptions/OFChangeCurrentDirectoryPathFailedException.h [0196a16f5d] to src/exceptions/OFChangeCurrentDirectoryFailedException.h [c93252d4da].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 */

#import "OFException.h"

OF_ASSUME_NONNULL_BEGIN

/**
 * @class OFChangeCurrentDirectoryPathFailedException \
 *	  OFChangeCurrentDirectoryPathFailedException.h \
 *	  ObjFW/OFChangeCurrentDirectoryPathFailedException.h
 *
 * @brief An exception indicating that changing the current directory path
 *	  failed.
 */
@interface OFChangeCurrentDirectoryPathFailedException: OFException
{
	OFString *_path;
	int _errNo;
	OF_RESERVE_IVARS(OFChangeCurrentDirectoryPathFailedException, 4)
}

/**
 * @brief The path of the directory to which the current path could not be
 *	  changed.
 */
@property (readonly, nonatomic) OFString *path;







|
|
|




|



|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 */

#import "OFException.h"

OF_ASSUME_NONNULL_BEGIN

/**
 * @class OFChangeCurrentDirectoryFailedException \
 *	  OFChangeCurrentDirectoryFailedException.h \
 *	  ObjFW/OFChangeCurrentDirectoryFailedException.h
 *
 * @brief An exception indicating that changing the current directory path
 *	  failed.
 */
@interface OFChangeCurrentDirectoryFailedException: OFException
{
	OFString *_path;
	int _errNo;
	OF_RESERVE_IVARS(OFChangeCurrentDirectoryFailedException, 4)
}

/**
 * @brief The path of the directory to which the current path could not be
 *	  changed.
 */
@property (readonly, nonatomic) OFString *path;

Renamed and modified src/exceptions/OFChangeCurrentDirectoryPathFailedException.m [35ec7fdb32] to src/exceptions/OFChangeCurrentDirectoryFailedException.m [7267a7e220].

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFChangeCurrentDirectoryPathFailedException.h"
#import "OFString.h"

@implementation OFChangeCurrentDirectoryPathFailedException
@synthesize path = _path, errNo = _errNo;

+ (instancetype)exceptionWithPath: (OFString *)path errNo: (int)errNo
{
	return [[[self alloc] initWithPath: path errNo: errNo] autorelease];
}








|


|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFChangeCurrentDirectoryFailedException.h"
#import "OFString.h"

@implementation OFChangeCurrentDirectoryFailedException
@synthesize path = _path, errNo = _errNo;

+ (instancetype)exceptionWithPath: (OFString *)path errNo: (int)errNo
{
	return [[[self alloc] initWithPath: path errNo: errNo] autorelease];
}

57
58
59
60
61
62
63
64
65
66
67

	[super dealloc];
}

- (OFString *)description
{
	return [OFString stringWithFormat:
	    @"Failed to change the current directory path to %@: %@",
	    _path, OFStrError(_errNo)];
}
@end







|



57
58
59
60
61
62
63
64
65
66
67

	[super dealloc];
}

- (OFString *)description
{
	return [OFString stringWithFormat:
	    @"Failed to change the current directory to %@: %@",
	    _path, OFStrError(_errNo)];
}
@end