On Mar 22, 2009, at 12:27 PM, Pierce Freeman wrote:

I am wondering if there is some way to change another applications icon programmatically. The problem that I see if that every application's icon name is different and I haven't found a way to read that application's icon
location or will just return a NSImage that is the icon.

Problems:

1 - Not all users are administrators of their computer, and so a user- space application may not be able to modify the application bundles in question. You'll need to authenticate/authorize the user to perform this change if the application is in the /Applications folder, or the user has no write permissions for the app bundles otherwise.

2 - Some applications may be digitally signed, in which case modifying the application bundles in question may at least cause disconcerting warnings for the user launching the modified applications, and at worst break the application(s).

3 - This may be technically in violation of the EULA of the applications in question. IANAL, but I certainly would look into this before trying it, especially with the very loosely-defined DMCA laws.

4 - All the above aside, make sure you have your users' express permission to perform this action ... it is a pretty big deal and I would personally not use any application that does this, and you can count on others feeling the same way, so make sure you ask in very clear, plain language.

That said, to get the application's icon, you can do what the Finder does and use the app bundle's Info.plist and ask for the value for the CFBundleIconFile key. Then ask the application bundle for the resource with the returned name.

See the documentation for the permissions issue and for how to work with the icon file format.

--
I.S.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to