File tree 1 file changed +14
-13
lines changed
1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -57,26 +57,27 @@ + (BOOL)requiresMainQueueSetup
57
57
NSError *error = nil ;
58
58
59
59
NSArray *contents = [fileManager contentsOfDirectoryAtPath: dirPath error: &error];
60
-
61
- contents = [contents rnfs_mapObjectsUsingBlock: ^ id (NSString *obj, NSUInteger idx ) {
60
+ NSMutableArray *tagetContents = [[ NSMutableArray alloc ] init ];
61
+ for (NSString *obj in contents ) {
62
62
NSString *path = [dirPath stringByAppendingPathComponent: obj];
63
63
NSDictionary *attributes = [fileManager attributesOfItemAtPath: path error: nil ];
64
-
65
- return @{
66
- @" ctime" : [self dateToTimeIntervalNumber: (NSDate *)[attributes objectForKey: NSFileCreationDate ]],
67
- @" mtime" : [self dateToTimeIntervalNumber: (NSDate *)[attributes objectForKey: NSFileModificationDate ]],
68
- @" name" : obj,
69
- @" path" : path,
70
- @" size" : [attributes objectForKey: NSFileSize ],
71
- @" type" : [attributes objectForKey: NSFileType ]
72
- };
73
- }];
64
+ if (attributes != nil ) {
65
+ [tagetContents addObject: @{
66
+ @" ctime" : [self dateToTimeIntervalNumber: (NSDate *)[attributes objectForKey: NSFileCreationDate ]],
67
+ @" mtime" : [self dateToTimeIntervalNumber: (NSDate *)[attributes objectForKey: NSFileModificationDate ]],
68
+ @" name" : obj,
69
+ @" path" : path,
70
+ @" size" : [attributes objectForKey: NSFileSize ],
71
+ @" type" : [attributes objectForKey: NSFileType ]
72
+ }];
73
+ }
74
+ }
74
75
75
76
if (error) {
76
77
return [self reject: reject withError: error];
77
78
}
78
79
79
- resolve (contents );
80
+ resolve (tagetContents );
80
81
}
81
82
82
83
RCT_EXPORT_METHOD (exists:(NSString *)filepath
You can’t perform that action at this time.
0 commit comments