• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
iconForFile
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iconForFile


  • Subject: iconForFile
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Mon, 31 Jul 2006 23:08:15 +0200

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: iconForFile
      • From: "Shawn Erickson" <email@hidden>
  • Prev by Date: Re: Obtaining environment variables from a cross-referenced project
  • Next by Date: Re: Checking a method for parameter types via SEL
  • Previous by thread: Re: Bound object of NSPopUpButton always the same
  • Next by thread: Re: iconForFile
  • Index(es):
    • Date
    • Thread