Skip navigation.
 
mliconForFile
FROM : Gerriet M. Denkmann
DATE : Mon Jul 31 23:08:15 2006

This works fine:

NSString *ff = [ someWindow representedFilename ] ;
NSImage *icon = [ [ NSWorkspace sharedWorkspace ] iconForFile: ff ];

For unsaved documents the representedFilename is an empty string, and 
iconForFile: returns a nice default icon.

But in this case (empty string) I also get a log message: "...Path 
given to -[NSWorkspace iconForFile:] is not a full path."
This message correct and all according to documentation. But I don't 
want it.

So: how do I get the default document icon without a log message?

Currently I am using this rather clumsy work-around:
if ( ![ ff isAbsolutePath ] ) ff = [ [ NSBundle mainBundle ] 
pathForResource: @"Info" ofType: @"plist" ];
But what if plist gets its own icon?

Clearly there must be a better way.

Gerriet.

Related mailsAuthorDate
mliconForFile Gerriet M. Denkman… Jul 31, 23:08
mlRe: iconForFile Shawn Erickson Aug 1, 01:19