How to find icon file path, Part II
How to find icon file path, Part II
- Subject: How to find icon file path, Part II
- From: Chris Anderson <email@hidden>
- Date: Wed, 24 Jul 2002 11:33:05 -0700
Many thanks to all for educating me on this topic. I've concluded that my
original question was based on something of an incorrect assumption, so I'll
try once more...
My application wants to display icons for files - lots of them. I
immediately discovered that getting big piles of icons via NSWorkspace
iconForFile: uses up huge amounts of time and memory, likely because it
returns a new NSImage and a new copy of all the icon's bitmap data at all
resolutions each time it's invoked (as seen via gdb.)
So I was hoping to be able to test for icon identity across files without
having to rummage around on disk very much or reload data that I've already
got. Evidently Cocoa can't do this directly, and it looks like Icon Services
might help, but not being a Carbonhead I immediately went down a big
rathole trying to figure out what's required.
GetIconRefFromFile() should give back an 'icon-unique' pointer (I think!) if
I give it an FSSpec. But that is in turn made (via FSMakeFSSpec) from a
volume reference number and a ConstStr255Param string and a directory id,
none of which I have any idea how to get from my NSString path... not to
mention how I ought to interpret the 'sint16 *' string that will contain the
label when GetIconRefFromFile returns...
Can I avoid utterly Carbonizing myself in order to do this, or should I just
give up and do CRC's on all the bitmaps, which I can at least use to save
memory, if not time? Are there docs on Carbon<->Cocoa mappings or relevant
examples? A quick Sherlock session did not yield me useful results.
With much gratitude,
--Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.