[Pythonmac-SIG] Possibly OT: Get path to icon file for PIL?

Kevin Walzer kw at codebykevin.com
Fri Jan 4 17:29:42 CET 2008


Ronald Oussoren wrote:

> You can do this through the bundle API (open the bundle for an 
> application, look up the name of the icon from the Info.plist and then 
> locate that icon.
> 
> Something like:
> 
> path = ...
> bundle = NSBundle.bundleWithPath_(path)
> info = bundle.infoDictionary()
> iconName = info['CFBundleIconFile']
> iconPath = bundle.pathForResource_ofType_(iconName, 'icns')
> 


Thanks, I'll give this a try! I would probably have to add an extra step 
(getInfoForFile:application:type) to this to get the image for an 
arbitrary file type, but this looks promising.

-- 
Kevin Walzer
Code by Kevin
http://www.codebykevin.com


More information about the Pythonmac-SIG mailing list