mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2024-11-26 00:49:20 +00:00
how could I live without ARC?
This commit is contained in:
parent
bf0a142c90
commit
38933ff6e1
@ -103,14 +103,17 @@ LOCALFUNC blnr FindNamedChildFilePath(NSString *parentPath, char *ChildName, NSS
|
|||||||
BOOL isDirectory;
|
BOOL isDirectory;
|
||||||
if ([fm fileExistsAtPath:parentPath isDirectory:&isDirectory] && isDirectory) {
|
if ([fm fileExistsAtPath:parentPath isDirectory:&isDirectory] && isDirectory) {
|
||||||
NSString *searchString = @(ChildName).lowercaseString;
|
NSString *searchString = @(ChildName).lowercaseString;
|
||||||
*childPath = NULL;
|
__block NSString *foundName = nil;
|
||||||
[[fm contentsOfDirectoryAtPath:parentPath error:NULL] enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
[[fm contentsOfDirectoryAtPath:parentPath error:NULL] enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
if ([obj.lowercaseString isEqualToString:searchString]) {
|
if ([obj.lowercaseString isEqualToString:searchString]) {
|
||||||
*stop = YES;
|
*stop = YES;
|
||||||
*childPath = [parentPath stringByAppendingPathComponent:obj];
|
foundName = obj;
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
return *childPath != NULL;
|
if (foundName) {
|
||||||
|
*childPath = [parentPath stringByAppendingPathComponent:foundName];
|
||||||
|
}
|
||||||
|
return foundName != nil;
|
||||||
} else {
|
} else {
|
||||||
return falseblnr;
|
return falseblnr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user