• 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
Re: Determine whether a file has a custom icon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determine whether a file has a custom icon


  • Subject: Re: Determine whether a file has a custom icon
  • From: Ricky Sharp <email@hidden>
  • Date: Mon, 3 Dec 2007 17:56:30 -0600


On Dec 3, 2007, at 5:07 PM, Adrian Ross wrote:

Hi there,

Can anyone help me determine whether a file or folder has a custom icon? For example, I'd like to know whether the Finder would display the default folder icon for a given folder, or some other icon.

I know I can use +iconForFile in NSWorkspace to get an NSImage of the icon in question, but I don't know how to tell whether this is a default icon or a custom one.

A previous proposed solution on this list was to use kHasCustomIcon in the Finder flags. This is rarely set and doesn't do the trick.


I think you'll have to deal with checking for either the kHasCustomIcon bit being set or if the folder contains a file named Icon\r (yes, 'Icon' followed by a CR, 0x0D).

Such a file will store the custom icon data in either the resource fork or data fork.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Determine whether a file has a custom icon (From: Adrian Ross <email@hidden>)

  • Prev by Date: Re: custom control and nsformatter
  • Next by Date: Re: Determine whether a file has a custom icon
  • Previous by thread: Determine whether a file has a custom icon
  • Next by thread: Re: Determine whether a file has a custom icon
  • Index(es):
    • Date
    • Thread