︙ | | | ︙ | |
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#import "OFCreateDirectoryFailedException.h"
#import "OFCreateSymbolicLinkFailedException.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFLinkFailedException.h"
#import "OFLockFailedException.h"
#import "OFMoveItemFailedException.h"
#import "OFOpenFileFailedException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFRemoveItemFailedException.h"
#import "OFSeekFailedException.h"
#import "OFUnlockFailedException.h"
#import "OFWriteFailedException.h"
|
|
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#import "OFCreateDirectoryFailedException.h"
#import "OFCreateSymbolicLinkFailedException.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFLinkFailedException.h"
#import "OFLockFailedException.h"
#import "OFMoveItemFailedException.h"
#import "OFOpenItemFailedException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFRemoveItemFailedException.h"
#import "OFSeekFailedException.h"
#import "OFUnlockFailedException.h"
#import "OFWriteFailedException.h"
|
︙ | | | ︙ | |
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
#ifndef _WIN32
DIR *dir;
encoding = [OFSystemInfo native8BitEncoding];
if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL)
@throw [OFOpenFileFailedException exceptionWithPath: path
mode: @"r"
errNo: errno];
# if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS)
if (!of_mutex_lock(&mutex))
@throw [OFLockFailedException exception];
# endif
|
|
<
|
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
#ifndef _WIN32
DIR *dir;
encoding = [OFSystemInfo native8BitEncoding];
if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL)
@throw [OFOpenItemFailedException exceptionWithPath: path
errNo: errno];
# if !defined(HAVE_READDIR_R) && defined(OF_HAVE_THREADS)
if (!of_mutex_lock(&mutex))
@throw [OFLockFailedException exception];
# endif
|
︙ | | | ︙ | |
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
|
if ((handle = FindFirstFileW([path UTF16String],
&fd)) == INVALID_HANDLE_VALUE) {
int errNo = 0;
if (GetLastError() == ERROR_FILE_NOT_FOUND)
errNo = ENOENT;
@throw [OFOpenFileFailedException exceptionWithPath: path
mode: @"r"
errNo: errNo];
}
@try {
do {
void *pool2 = objc_autoreleasePoolPush();
OFString *file;
|
|
<
|
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
|
if ((handle = FindFirstFileW([path UTF16String],
&fd)) == INVALID_HANDLE_VALUE) {
int errNo = 0;
if (GetLastError() == ERROR_FILE_NOT_FOUND)
errNo = ENOENT;
@throw [OFOpenItemFailedException exceptionWithPath: path
errNo: errNo];
}
@try {
do {
void *pool2 = objc_autoreleasePoolPush();
OFString *file;
|
︙ | | | ︙ | |
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
|
of_stat_t s;
if (path == nil)
@throw [OFInvalidArgumentException exception];
if (of_stat(path, &s) != 0)
/* FIXME: Maybe use another exception? */
@throw [OFOpenFileFailedException exceptionWithPath: path
mode: @"r"
errNo: errno];
return s.st_size;
}
+ (OFDate*)accessTimeOfItemAtPath: (OFString*)path
{
of_stat_t s;
if (path == nil)
@throw [OFInvalidArgumentException exception];
if (of_stat(path, &s) != 0)
/* FIXME: Maybe use another exception? */
@throw [OFOpenFileFailedException exceptionWithPath: path
mode: @"r"
errNo: errno];
/* FIXME: We could be more precise on some OSes */
return [OFDate dateWithTimeIntervalSince1970: s.st_atime];
}
+ (OFDate*)modificationTimeOfItemAtPath: (OFString*)path
{
of_stat_t s;
if (path == nil)
@throw [OFInvalidArgumentException exception];
if (of_stat(path, &s) != 0)
/* FIXME: Maybe use another exception? */
@throw [OFOpenFileFailedException exceptionWithPath: path
mode: @"r"
errNo: errno];
/* FIXME: We could be more precise on some OSes */
return [OFDate dateWithTimeIntervalSince1970: s.st_mtime];
}
+ (OFDate*)statusChangeTimeOfItemAtPath: (OFString*)path
{
of_stat_t s;
if (path == nil)
@throw [OFInvalidArgumentException exception];
if (of_stat(path, &s) != 0)
/* FIXME: Maybe use another exception? */
@throw [OFOpenFileFailedException exceptionWithPath: path
mode: @"r"
errNo: errno];
/* FIXME: We could be more precise on some OSes */
return [OFDate dateWithTimeIntervalSince1970: s.st_ctime];
}
#ifdef OF_HAVE_CHMOD
|
|
<
|
<
|
<
|
<
|
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
|
of_stat_t s;
if (path == nil)
@throw [OFInvalidArgumentException exception];
if (of_stat(path, &s) != 0)
/* FIXME: Maybe use another exception? */
@throw [OFOpenItemFailedException exceptionWithPath: path
errNo: errno];
return s.st_size;
}
+ (OFDate*)accessTimeOfItemAtPath: (OFString*)path
{
of_stat_t s;
if (path == nil)
@throw [OFInvalidArgumentException exception];
if (of_stat(path, &s) != 0)
/* FIXME: Maybe use another exception? */
@throw [OFOpenItemFailedException exceptionWithPath: path
errNo: errno];
/* FIXME: We could be more precise on some OSes */
return [OFDate dateWithTimeIntervalSince1970: s.st_atime];
}
+ (OFDate*)modificationTimeOfItemAtPath: (OFString*)path
{
of_stat_t s;
if (path == nil)
@throw [OFInvalidArgumentException exception];
if (of_stat(path, &s) != 0)
/* FIXME: Maybe use another exception? */
@throw [OFOpenItemFailedException exceptionWithPath: path
errNo: errno];
/* FIXME: We could be more precise on some OSes */
return [OFDate dateWithTimeIntervalSince1970: s.st_mtime];
}
+ (OFDate*)statusChangeTimeOfItemAtPath: (OFString*)path
{
of_stat_t s;
if (path == nil)
@throw [OFInvalidArgumentException exception];
if (of_stat(path, &s) != 0)
/* FIXME: Maybe use another exception? */
@throw [OFOpenItemFailedException exceptionWithPath: path
errNo: errno];
/* FIXME: We could be more precise on some OSes */
return [OFDate dateWithTimeIntervalSince1970: s.st_ctime];
}
#ifdef OF_HAVE_CHMOD
|
︙ | | | ︙ | |
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
|
@throw [OFInvalidArgumentException exception];
encoding = [OFSystemInfo native8BitEncoding];
length = readlink([path cStringWithEncoding: encoding],
destination, PATH_MAX);
if (length < 0)
@throw [OFOpenFileFailedException exceptionWithPath: path
mode: @"r"
errNo: errno];
return [OFString stringWithCString: destination
encoding: encoding
length: length];
}
#endif
|
>
|
<
|
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
|
@throw [OFInvalidArgumentException exception];
encoding = [OFSystemInfo native8BitEncoding];
length = readlink([path cStringWithEncoding: encoding],
destination, PATH_MAX);
if (length < 0)
/* FIXME: Maybe use another exception? */
@throw [OFOpenItemFailedException exceptionWithPath: path
errNo: errno];
return [OFString stringWithCString: destination
encoding: encoding
length: length];
}
#endif
|
︙ | | | ︙ | |
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
|
#elif defined(OF_HAVE_OFF64_T)
if ((_fd = open64([path cStringWithEncoding: [OFSystemInfo
native8BitEncoding]], flags, DEFAULT_MODE)) == -1)
#else
if ((_fd = open([path cStringWithEncoding: [OFSystemInfo
native8BitEncoding]], flags, DEFAULT_MODE)) == -1)
#endif
@throw [OFOpenFileFailedException
exceptionWithPath: path
mode: mode
errNo: errno];
} @catch (id e) {
[self release];
@throw e;
}
|
|
|
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
|
#elif defined(OF_HAVE_OFF64_T)
if ((_fd = open64([path cStringWithEncoding: [OFSystemInfo
native8BitEncoding]], flags, DEFAULT_MODE)) == -1)
#else
if ((_fd = open([path cStringWithEncoding: [OFSystemInfo
native8BitEncoding]], flags, DEFAULT_MODE)) == -1)
#endif
@throw [OFOpenItemFailedException
exceptionWithPath: path
mode: mode
errNo: errno];
} @catch (id e) {
[self release];
@throw e;
}
|
︙ | | | ︙ | |