From 38933ff6e1b15a0495e1ac9d756526945bb64ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20A=2E=20A=CC=81lvarez?= Date: Thu, 26 May 2016 21:30:20 +0200 Subject: [PATCH] how could I live without ARC? --- Mini vMac/MYOSGLUE.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Mini vMac/MYOSGLUE.m b/Mini vMac/MYOSGLUE.m index f12dcad..71f64c9 100644 --- a/Mini vMac/MYOSGLUE.m +++ b/Mini vMac/MYOSGLUE.m @@ -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; }