Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iconForFile



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.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.