mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Use file’s display name instead of CFBundleName
This seems to be what Finder does, and some bundles (Spotify.app) actually lack a CFBundleName key. Also ensure our bundle has a CFBundleIdentifier.
This commit is contained in:
@@ -45,15 +45,21 @@ static NSArray* ApplicationURLsForPaths (NSSet* paths)
|
||||
{
|
||||
if(NSBundle* bundle = [NSBundle bundleWithURL:url])
|
||||
{
|
||||
NSString* identifier = [bundle bundleIdentifier];
|
||||
counts[identifier] = @([counts[identifier] intValue] + 1);
|
||||
[apps addObject:@{
|
||||
@"identifier" : identifier,
|
||||
@"name" : [bundle objectForInfoDictionaryKey:@"CFBundleName"],
|
||||
@"version" : [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"] ?: ([bundle objectForInfoDictionaryKey:@"CFBundleVersion"] ?: @"???"),
|
||||
@"url" : url,
|
||||
@"isDefault" : @([defaultAppURLs containsObject:url]),
|
||||
}];
|
||||
if(NSString* identifier = [bundle bundleIdentifier])
|
||||
{
|
||||
counts[identifier] = @([counts[identifier] intValue] + 1);
|
||||
[apps addObject:@{
|
||||
@"identifier" : identifier,
|
||||
@"name" : [[NSFileManager defaultManager] displayNameAtPath:[url path]],
|
||||
@"version" : [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"] ?: ([bundle objectForInfoDictionaryKey:@"CFBundleVersion"] ?: @"???"),
|
||||
@"url" : url,
|
||||
@"isDefault" : @([defaultAppURLs containsObject:url]),
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"warning: missing CFBundleIdentifier: %@", bundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user