Is there any way to find out the .icns file an IconRef refers to or has been loaded from? Or even the id of the containing bundle if there is one?
I understand that not all icons are loaded directly from a file (composite icons for example) so this wouldn't work all the time.
The question I'm trying to answer is "Where does the icon the Finder would display for file X originate?" Note that I'm interested in the origin of the icon in the file system, not the icon's image data. As far as I can tell, the workings behind going from file path to icon - eg. GetIconRefFromFileInfo and NSWorkspace.iconForFile - are fairly opaque.
I'm open to undocumented/private solutions if that's what it takes.
@millenomi: Yes, avoiding Apple's icons is the point of the exercise.