Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get NSImage of generic folder icon on OS X 10.5 and 10.6

I'm writing a Cocoa application that displays the contents of an archive file in an NSOutlineView. I provide a custom icon for an NSBrowserCell in the outline column, and it works great, but I ran into a little snag — using [NSImage imageNamed:@"NSFolder"] returns the correct image (a generic folder icon) on 10.6, but on 10.5 it returns nil, so all the folder icons disappear. (I can't find any documentation on the NSFolder icon name to see when it was introduced — I got it working by trial and error.)

Is there a non-deprecated method for getting a generic folder icon that works on both 10.5 and 10.6?

like image 468
Quinn Taylor Avatar asked Sep 17 '09 23:09

Quinn Taylor


1 Answers

[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)]

(I think)

like image 110
Wevah Avatar answered Sep 24 '22 18:09

Wevah