1

I have an NSOutlineView that displays a directory hierarchy (not necessarily local). I want to display the icon for each item in the list, so I'm using NSWorkspace's -iconForFileType: method, since I can't use -iconForFile: as the path isn't always local (could be FTP, SFTP etc).

When I use NSDirectoryFileType I'm getting warnings that it was deprecated in Snow Leopard. How else can I go about achieving this task?

Basically I need a non-deprecated way to get the icon for any given file (and for a directory), given only the filename (and whether or not it is a directory), not a full local path.

if ([(EDFileStoreItem *)item type] == EDFileStoreItemDirectory) {
    // WARNING: Deprecated in OS X 10.6
    [(EDImageAndTextCell *)cell setIconImage:[[NSWorkspace sharedWorkspace] iconForFileType:NSDirectoryFileType]];
}

UPDATE: Ok, I figured it out:

NSImage *directoryIcon = [NSImage imageNamed:NSImageNameFolder];
d11wtq
  • 34,788
  • 19
  • 120
  • 195

1 Answers1

0
NSImage *directoryIcon = [NSImage imageNamed:NSImageNameFolder];

Only available in Snow Leopard, AFAIK.

d11wtq
  • 34,788
  • 19
  • 120
  • 195