Re: Getting folder icon image
Re: Getting folder icon image
- Subject: Re: Getting folder icon image
- From: Ondra Cada <email@hidden>
- Date: Tue, 2 Jul 2002 19:57:48 +0200
On Tuesday, July 2, 2002, at 06:53 , fritx wrote:
I'm writing a little 'file browser' app that uses an NSOutlineView to
show the file heirarchy to the user. I wanted to add an appropriate icon
for the files in each cell as well and found that NSWorkspace seemed to
have exactly what I wanted:
NSImage *fileImage = [[NSWorkspace sharedWorkspace]
iconForFileType:[myFile extension]];
Actually, it's not what you wanted, I guess.
(Where [myFile extension] returns, for example @"tiff").
This works well but my problem is I can't find a way to get the image for
file elements that have no extension (such as folders). Any ideas?
Yup. Just read on docs/headers/whatever till you bump into
- (NSImage *)iconForFile:(NSString *)fullPath;
It gives (or, rather, *should give* -- I haven't checked myself; the cause
to be wary being that Finder's a Carbon rot, thus it very probably uses
other ways than NSWorkspace) the appropriate icon for any file, be it a
folder or not, have it a suffix or not, and have it a specific icon or not.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.