︙ | | | ︙ | |
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
[attributes setObject: [NSNumber numberWithUnsignedLong: s->st_gid]
forKey: of_file_attribute_key_posix_gid];
# ifdef OF_HAVE_THREADS
[passwdMutex lock];
@try {
# endif
of_string_encoding_t encoding = [OFLocale encoding];
struct passwd *passwd = getpwuid(s->st_uid);
struct group *group_ = getgrgid(s->st_gid);
if (passwd != NULL) {
OFString *owner = [OFString
stringWithCString: passwd->pw_name
encoding: encoding];
|
|
|
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
[attributes setObject: [NSNumber numberWithUnsignedLong: s->st_gid]
forKey: of_file_attribute_key_posix_gid];
# ifdef OF_HAVE_THREADS
[passwdMutex lock];
@try {
# endif
OFStringEncoding encoding = [OFLocale encoding];
struct passwd *passwd = getpwuid(s->st_uid);
struct group *group_ = getgrgid(s->st_gid);
if (passwd != NULL) {
OFString *owner = [OFString
stringWithCString: passwd->pw_name
encoding: encoding];
|
︙ | | | ︙ | |
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
|
#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
static void
setSymbolicLinkDestinationAttribute(of_mutable_file_attributes_t attributes,
OFURL *URL)
{
OFString *path = URL.fileSystemRepresentation;
# ifndef OF_WINDOWS
of_string_encoding_t encoding = [OFLocale encoding];
char destinationC[PATH_MAX];
ssize_t length;
OFString *destination;
of_file_attribute_key_t key;
length = readlink([path cStringWithEncoding: encoding], destinationC,
PATH_MAX);
|
|
|
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
|
#ifdef OF_FILE_MANAGER_SUPPORTS_SYMLINKS
static void
setSymbolicLinkDestinationAttribute(of_mutable_file_attributes_t attributes,
OFURL *URL)
{
OFString *path = URL.fileSystemRepresentation;
# ifndef OF_WINDOWS
OFStringEncoding encoding = [OFLocale encoding];
char destinationC[PATH_MAX];
ssize_t length;
OFString *destination;
of_file_attribute_key_t key;
length = readlink([path cStringWithEncoding: encoding], destinationC,
PATH_MAX);
|
︙ | | | ︙ | |
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
|
attributeKey: (of_file_attribute_key_t)attributeKey
attributes: (of_file_attributes_t)attributes OF_DIRECT
{
#ifdef OF_FILE_MANAGER_SUPPORTS_OWNER
OFString *path = URL.fileSystemRepresentation;
uid_t uid = -1;
gid_t gid = -1;
of_string_encoding_t encoding;
if (owner == nil && group == nil)
@throw [OFInvalidArgumentException exception];
encoding = [OFLocale encoding];
# ifdef OF_HAVE_THREADS
|
|
|
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
|
attributeKey: (of_file_attribute_key_t)attributeKey
attributes: (of_file_attributes_t)attributes OF_DIRECT
{
#ifdef OF_FILE_MANAGER_SUPPORTS_OWNER
OFString *path = URL.fileSystemRepresentation;
uid_t uid = -1;
gid_t gid = -1;
OFStringEncoding encoding;
if (owner == nil && group == nil)
@throw [OFInvalidArgumentException exception];
encoding = [OFLocale encoding];
# ifdef OF_HAVE_THREADS
|
︙ | | | ︙ | |
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
|
exceptionWithObject: self
requestedLength: 0
errNo: retrieveError()];
} @finally {
FindClose(handle);
}
} else {
of_string_encoding_t encoding = [OFLocale encoding];
WIN32_FIND_DATA fd;
if ((handle = FindFirstFileA(
[path cStringWithEncoding: encoding], &fd)) ==
INVALID_HANDLE_VALUE)
@throw [OFOpenItemFailedException
exceptionWithURL: URL
|
|
|
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
|
exceptionWithObject: self
requestedLength: 0
errNo: retrieveError()];
} @finally {
FindClose(handle);
}
} else {
OFStringEncoding encoding = [OFLocale encoding];
WIN32_FIND_DATA fd;
if ((handle = FindFirstFileA(
[path cStringWithEncoding: encoding], &fd)) ==
INVALID_HANDLE_VALUE)
@throw [OFOpenItemFailedException
exceptionWithURL: URL
|
︙ | | | ︙ | |
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
|
requestedLength: 0
errNo: retrieveError()];
} @finally {
FindClose(handle);
}
}
#elif defined(OF_AMIGAOS)
of_string_encoding_t encoding = [OFLocale encoding];
BPTR lock;
if ((lock = Lock([path cStringWithEncoding: encoding],
SHARED_LOCK)) == 0)
@throw [OFOpenItemFailedException
exceptionWithURL: URL
mode: nil
|
|
|
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
|
requestedLength: 0
errNo: retrieveError()];
} @finally {
FindClose(handle);
}
}
#elif defined(OF_AMIGAOS)
OFStringEncoding encoding = [OFLocale encoding];
BPTR lock;
if ((lock = Lock([path cStringWithEncoding: encoding],
SHARED_LOCK)) == 0)
@throw [OFOpenItemFailedException
exceptionWithURL: URL
mode: nil
|
︙ | | | ︙ | |
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
|
exceptionWithObject: self
requestedLength: 0
errNo: retrieveError()];
} @finally {
UnLock(lock);
}
#else
of_string_encoding_t encoding = [OFLocale encoding];
DIR *dir;
if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL)
@throw [OFOpenItemFailedException exceptionWithURL: URL
mode: nil
errNo: errno];
# if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS)
|
|
|
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
|
exceptionWithObject: self
requestedLength: 0
errNo: retrieveError()];
} @finally {
UnLock(lock);
}
#else
OFStringEncoding encoding = [OFLocale encoding];
DIR *dir;
if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL)
@throw [OFOpenItemFailedException exceptionWithURL: URL
mode: nil
errNo: errno];
# if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS)
|
︙ | | | ︙ | |
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
|
![destination.scheme isEqual: _scheme])
@throw [OFInvalidArgumentException exception];
sourcePath = source.fileSystemRepresentation;
destinationPath = destination.fileSystemRepresentation;
# ifndef OF_WINDOWS
of_string_encoding_t encoding = [OFLocale encoding];
if (link([sourcePath cStringWithEncoding: encoding],
[destinationPath cStringWithEncoding: encoding]) != 0)
@throw [OFLinkFailedException
exceptionWithSourceURL: source
destinationURL: destination
errNo: errno];
|
|
|
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
|
![destination.scheme isEqual: _scheme])
@throw [OFInvalidArgumentException exception];
sourcePath = source.fileSystemRepresentation;
destinationPath = destination.fileSystemRepresentation;
# ifndef OF_WINDOWS
OFStringEncoding encoding = [OFLocale encoding];
if (link([sourcePath cStringWithEncoding: encoding],
[destinationPath cStringWithEncoding: encoding]) != 0)
@throw [OFLinkFailedException
exceptionWithSourceURL: source
destinationURL: destination
errNo: errno];
|
︙ | | | ︙ | |
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
|
if (![URL.scheme isEqual: _scheme])
@throw [OFInvalidArgumentException exception];
path = URL.fileSystemRepresentation;
# ifndef OF_WINDOWS
of_string_encoding_t encoding = [OFLocale encoding];
if (symlink([target cStringWithEncoding: encoding],
[path cStringWithEncoding: encoding]) != 0)
@throw [OFCreateSymbolicLinkFailedException
exceptionWithURL: URL
target: target
errNo: errno];
|
|
|
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
|
if (![URL.scheme isEqual: _scheme])
@throw [OFInvalidArgumentException exception];
path = URL.fileSystemRepresentation;
# ifndef OF_WINDOWS
OFStringEncoding encoding = [OFLocale encoding];
if (symlink([target cStringWithEncoding: encoding],
[path cStringWithEncoding: encoding]) != 0)
@throw [OFCreateSymbolicLinkFailedException
exceptionWithURL: URL
target: target
errNo: errno];
|
︙ | | | ︙ | |
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
|
exceptionWithSourceURL: source
destinationURL: destination
errNo: EEXIST];
pool = objc_autoreleasePoolPush();
#ifdef OF_AMIGAOS
of_string_encoding_t encoding = [OFLocale encoding];
if (!Rename([source.fileSystemRepresentation
cStringWithEncoding: encoding],
[destination.fileSystemRepresentation
cStringWithEncoding: encoding]))
@throw [OFMoveItemFailedException
exceptionWithSourceURL: source
destinationURL: destination
errNo: retrieveError()];
#else
int status;
# ifdef OF_WINDOWS
if ([OFSystemInfo isWindowsNT])
status = _wrename(source.fileSystemRepresentation.UTF16String,
destination.fileSystemRepresentation.UTF16String);
else {
# endif
of_string_encoding_t encoding = [OFLocale encoding];
status = rename([source.fileSystemRepresentation
cStringWithEncoding: encoding],
[destination.fileSystemRepresentation
cStringWithEncoding: encoding]);
# ifdef OF_WINDOWS
}
|
|
|
|
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
|
exceptionWithSourceURL: source
destinationURL: destination
errNo: EEXIST];
pool = objc_autoreleasePoolPush();
#ifdef OF_AMIGAOS
OFStringEncoding encoding = [OFLocale encoding];
if (!Rename([source.fileSystemRepresentation
cStringWithEncoding: encoding],
[destination.fileSystemRepresentation
cStringWithEncoding: encoding]))
@throw [OFMoveItemFailedException
exceptionWithSourceURL: source
destinationURL: destination
errNo: retrieveError()];
#else
int status;
# ifdef OF_WINDOWS
if ([OFSystemInfo isWindowsNT])
status = _wrename(source.fileSystemRepresentation.UTF16String,
destination.fileSystemRepresentation.UTF16String);
else {
# endif
OFStringEncoding encoding = [OFLocale encoding];
status = rename([source.fileSystemRepresentation
cStringWithEncoding: encoding],
[destination.fileSystemRepresentation
cStringWithEncoding: encoding]);
# ifdef OF_WINDOWS
}
|
︙ | | | ︙ | |