Icon is missing for some apps
BonzaiThePenguin opened this issue · 3 comments
BonzaiThePenguin commented
For some reason some apps aren't assigned an icon so there's just a blank spot next to their name, even though Loading is supposed to assign a generic app icon in those situations. Haven't yet looked into this one.
BonzaiThePenguin commented
The code for this is at the bottom of AppRecord.m:
if (self.icon == nil) {
// give it a "blank app" icon
NSImage *icon2 = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
[icon2 setSize:NSMakeSize(16, 16)];
self.icon = icon2;
}
BonzaiThePenguin commented
And the code that fails is here:
NSString *icon_name, *icon_path; NSImage *icon2;
if ((icon_name = [bundle objectForInfoDictionaryKey:@"CFBundleIconFile"]) &&
(icon_path = [[[bundle resourcePath] stringByAppendingString:@"/"] stringByAppendingString:icon_name])) {
if ([[icon_path pathExtension] length] == 0) icon_path = [icon_path stringByAppendingPathExtension:@"icns"];
if ((icon2 = [[NSImage alloc] initByReferencingFile:icon_path])) {
[icon2 setSize:NSMakeSize(16, 16)];
self.icon = icon2;
}
}
Maybe [[NSImage alloc] initByReferencingFile:icon_path]
returns a non-nil value even if icon_path does not exist? Haven't checked yet so I don't know!
BonzaiThePenguin commented
Fixed with 122d745.