Reputation: 107
I am trying to write the Code in Python to Change the Icon of a Mac OS X folder using just the Python Script (Without XCODE or any other API). The procedure is that I have a icon.icns file , I need to change the folder icon to the icon.icns file using the python script.
Upvotes: 3
Views: 1840
Reputation: 107
Let we have a icon.icns file:
- Read the com.apple.ResourceFork extended attribute from the icon file
- Set the com.apple.FinderInfo extended attribute with folder icon flag
- Create a Icon file (name: Icon\r) inside the target folder
- Set extended attributes com.apple.FinderInfo & com.apple.ResourceFork for icon file (name: Icon\r)
- Hide the icon file (name: Icon\r)
We can use stat and xattr modules to do this.
Upvotes: 2