Commit 584c4ebb authored by David Fuhrmann's avatar David Fuhrmann

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

(cherry picked from commit d86de10ce6a52c523dc33848b4f36fe22b5a7bb6)
Signed-off-by: default avatarDavid Fuhrmann <david.fuhrmann@googlemail.com>
parent 478d3fcd
...@@ -767,21 +767,41 @@ static VLCOpen *_o_sharedMainInstance = nil; ...@@ -767,21 +767,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) { {
NSString *currentFile = [dirContents objectAtIndex:i];
NSString *fullPath = [mountPath stringByAppendingPathComponent:currentFile];
BOOL isDir;
if ([fm fileExistsAtPath:fullPath isDirectory:&isDir] && isDir)
{
if ([currentFile caseInsensitiveCompare:@"SVCD"] == NSOrderedSame)
{
returnValue = kVLCMediaSVCD; returnValue = kVLCMediaSVCD;
break; break;
} }
if([[topLevelItems objectAtIndex:i] rangeOfString:@"VCD"].location != NSNotFound) { if ([currentFile caseInsensitiveCompare:@"VCD"] == NSOrderedSame)
{
returnValue = kVLCMediaVCD; returnValue = kVLCMediaVCD;
break; 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