Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SUHost's technique for getting a generic bundle icon did not work, fixed

  • Loading branch information...
commit 152e6f9572b25fba7504f5a7b7577474db5b1662 1 parent f8fbf37
Sean McBride authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 SUHost.m
View
12 SUHost.m
@@ -83,7 +83,17 @@ - (NSImage *)icon
iconPath = [bundle pathForResource:[bundle objectForInfoDictionaryKey:@"CFBundleIconFile"] ofType: nil];
NSImage *icon = [[[NSImage alloc] initWithContentsOfFile:iconPath] autorelease];
// Use a default icon if none is defined.
- if (!icon) { icon = [[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(bundle == [NSBundle mainBundle] ? kGenericApplicationIcon : UTGetOSTypeFromString(CFSTR("BNDL")))]; }
+ if (!icon) {
+ BOOL isMainBundle = (bundle == [NSBundle mainBundle]);
+
+ // Starting with 10.6, iconForFileType: accepts a UTI.
+ NSString *fileType = nil;
+ if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_5)
+ fileType = isMainBundle ? NSFileTypeForHFSTypeCode(kGenericApplicationIcon) : @".bundle";
+ else
+ fileType = isMainBundle ? (NSString*)kUTTypeApplication : (NSString*)kUTTypeBundle;
+ icon = [[NSWorkspace sharedWorkspace] iconForFileType:fileType];
+ }
return icon;
}
Please sign in to comment.
Something went wrong with that request. Please try again.