vlc | branch: master | Felix Paul Kühne <[email protected]> | Wed Jan 30 14:47:20 2019 +0100| [cbf902af5188654bd18bfb30ee78bf0c5b076455] | committer: Felix Paul Kühne
macosx: cosmetics > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cbf902af5188654bd18bfb30ee78bf0c5b076455 --- modules/gui/macosx/NSString+Helpers.m | 78 +++++++++++++++++------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/modules/gui/macosx/NSString+Helpers.m b/modules/gui/macosx/NSString+Helpers.m index 5db9a1a012..96c9272280 100644 --- a/modules/gui/macosx/NSString+Helpers.m +++ b/modules/gui/macosx/NSString+Helpers.m @@ -136,14 +136,14 @@ NSString *const kVLCMediaUnknown = @"Unknown"; NSMutableString *wrapped_string = [self mutableCopy]; NSTextStorage *text_storage = - [[NSTextStorage alloc] initWithString:wrapped_string - attributes:@{ - NSFontAttributeName : [NSFont labelFontOfSize: 0.0] - }]; + [[NSTextStorage alloc] initWithString:wrapped_string + attributes:@{ + NSFontAttributeName : [NSFont labelFontOfSize: 0.0] + }]; NSLayoutManager *layout_manager = [[NSLayoutManager alloc] init]; NSTextContainer *text_container = - [[NSTextContainer alloc] initWithContainerSize:NSMakeSize(width, 2000)]; + [[NSTextContainer alloc] initWithContainerSize:NSMakeSize(width, 2000)]; [layout_manager addTextContainer:text_container]; [text_storage addLayoutManager:layout_manager]; @@ -160,7 +160,7 @@ NSString *const kVLCMediaUnknown = @"Unknown"; charRange = [layout_manager characterRangeForGlyphRange:effectiveRange actualGlyphRange:&effectiveRange]; if ([wrapped_string lineRangeForRange: - NSMakeRange(charRange.location + breaksInserted, charRange.length) + NSMakeRange(charRange.location + breaksInserted, charRange.length) ].length > charRange.length) { [wrapped_string insertString:@"\n" atIndex:NSMaxRange(charRange) + breaksInserted]; @@ -296,42 +296,42 @@ NSString * getVolumeTypeFromMountPath(NSString *mountPath) out: if ([mountPath rangeOfString:@"VIDEO_TS" options:NSCaseInsensitiveSearch | NSBackwardsSearch].location != NSNotFound) returnValue = kVLCMediaVideoTSFolder; - else if ([mountPath rangeOfString:@"BDMV" options:NSCaseInsensitiveSearch | NSBackwardsSearch].location != NSNotFound) - returnValue = kVLCMediaBDMVFolder; - else { - // NSFileManager is not thread-safe, don't use defaultManager outside of the main thread - NSFileManager * fm = [[NSFileManager alloc] init]; - - NSArray *dirContents = [fm contentsOfDirectoryAtPath:mountPath error:nil]; - for (int i = 0; i < [dirContents count]; i++) { - 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; - 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; - } - } + else if ([mountPath rangeOfString:@"BDMV" options:NSCaseInsensitiveSearch | NSBackwardsSearch].location != NSNotFound) + returnValue = kVLCMediaBDMVFolder; + else { + // NSFileManager is not thread-safe, don't use defaultManager outside of the main thread + NSFileManager * fm = [[NSFileManager alloc] init]; + + NSArray *dirContents = [fm contentsOfDirectoryAtPath:mountPath error:nil]; + for (int i = 0; i < [dirContents count]; i++) { + 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; + break; } - - if (!returnValue) + 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; + } } + } + + if (!returnValue) + returnValue = kVLCMediaVideoTSFolder; + } return returnValue; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
