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

View File

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