NSDirectoryFileType is deprecated. What's the replacement?
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] == EDF开发者_如何学PythonileStoreItemDirectory) {
// 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];
NSImage *directoryIcon = [NSImage imageNamed:NSImageNameFolder];
Only available in Snow Leopard, AFAIK.
精彩评论