Skip to content

Commit 7a26e64

Browse files
authored
Merge pull request #27 from cielpy/prefix_issue
fixed incorrect behavior in listFilesInDirectoryAtPath:withPrefix method
2 parents 7336195 + b1173c9 commit 7a26e64

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

FCFileManager/FCFileManager.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,9 @@ +(NSArray *)listFilesInDirectoryAtPath:(NSString *)path withPrefix:(NSString *)p
424424
return [subpaths filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
425425

426426
NSString *subpath = (NSString *)evaluatedObject;
427-
428-
return ([subpath hasPrefix:prefix] || [subpath isEqualToString:prefix]);
427+
NSString *fileName = [subpath lastPathComponent];
428+
429+
return ([fileName hasPrefix:prefix] || [fileName isEqualToString:prefix]);
429430
}]];
430431
}
431432

0 commit comments

Comments
 (0)