allow mixed case ROM file name and initial disk images

This commit is contained in:
Jesús A. Álvarez 2016-05-26 21:19:42 +02:00
parent 061ac16a0a
commit bf0a142c90
1 changed files with 9 additions and 2 deletions

View File

@ -102,8 +102,15 @@ LOCALFUNC blnr FindNamedChildFilePath(NSString *parentPath, char *ChildName, NSS
NSFileManager *fm = [NSFileManager defaultManager];
BOOL isDirectory;
if ([fm fileExistsAtPath:parentPath isDirectory:&isDirectory] && isDirectory) {
*childPath = [parentPath stringByAppendingPathComponent:@(ChildName)];
return trueblnr;
NSString *searchString = @(ChildName).lowercaseString;
*childPath = NULL;
[[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];
}
}];
return *childPath != NULL;
} else {
return falseblnr;
}