Commit d86de10c authored by David Fuhrmann's avatar David Fuhrmann

macosx: disk open: do a shallow instead of a deep search for media directories

parent ad09e6fb
...@@ -837,21 +837,41 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -837,21 +837,41 @@ static VLCOpen *_o_sharedMainInstance = nil;
{ {
// NSFileManager is not thread-safe, don't use defaultManager outside of the main thread // NSFileManager is not thread-safe, don't use defaultManager outside of the main thread
NSFileManager * fm = [[NSFileManager alloc] init]; NSFileManager * fm = [[NSFileManager alloc] init];
NSArray * topLevelItems;
topLevelItems = [fm subpathsOfDirectoryAtPath: mountPath error: NULL];
[fm release];
NSUInteger itemCount = [topLevelItems count]; NSArray *dirContents = [fm contentsOfDirectoryAtPath:mountPath error:nil];
for (int i = 0; i < itemCount; i++) { for (int i = 0; i < [dirContents count]; i++)
if([[topLevelItems objectAtIndex:i] rangeOfString:@"SVCD"].location != NSNotFound) { {
returnValue = kVLCMediaSVCD; NSString *currentFile = [dirContents objectAtIndex:i];
break; NSString *fullPath = [mountPath stringByAppendingPathComponent:currentFile];
}
if([[topLevelItems objectAtIndex:i] rangeOfString:@"VCD"].location != NSNotFound) { BOOL isDir;
returnValue = kVLCMediaVCD; if ([fm fileExistsAtPath:fullPath isDirectory:&isDir] && isDir)
break; {
if ([currentFile caseInsensitiveCompare:@"SVCD"] == NSOrderedSame)
{
returnValue = kVLCMediaSVCD;
break;
}
if ([currentFile caseInsensitiveCompare:@"VCD"] == NSOrderedSame)
{
returnValue = kVLCMediaVCD;
break;
}
if ([currentFile caseInsensitiveCompare:@"BDMV"] == NSOrderedSame)
{
returnValue = kVLCMediaBDMVFolder;
break;
}
if ([currentFile caseInsensitiveCompare:@"VIDEO_TS"] == NSOrderedSame)
{
returnValue = kVLCMediaVideoTSFolder;
break;
}
} }
} }
[fm release];
if(!returnValue) if(!returnValue)
returnValue = kVLCMediaVideoTSFolder; returnValue = kVLCMediaVideoTSFolder;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment