how could I live without ARC?

This commit is contained in:
Jesús A. Álvarez 2016-05-26 21:30:20 +02:00
parent bf0a142c90
commit 38933ff6e1

View File

@ -103,14 +103,17 @@ LOCALFUNC blnr FindNamedChildFilePath(NSString *parentPath, char *ChildName, NSS
BOOL isDirectory;
if ([fm fileExistsAtPath:parentPath isDirectory:&isDirectory] && isDirectory) {
NSString *searchString = @(ChildName).lowercaseString;
*childPath = NULL;
__block NSString *foundName = nil;
[[fm contentsOfDirectoryAtPath:parentPath error:NULL] enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj.lowercaseString isEqualToString:searchString]) {
*stop = YES;
*childPath = [parentPath stringByAppendingPathComponent:obj];
foundName = obj;
}
}];
return *childPath != NULL;
if (foundName) {
*childPath = [parentPath stringByAppendingPathComponent:foundName];
}
return foundName != nil;
} else {
return falseblnr;
}