Custom icons for files or folders

Wins
New Contributor

Hello, I am trying to install a program that resides in a folder with a custom folder. After installation the icon file looses its attributes and the icon itself does not display. That means, composer displays things fine, but after the installation the folder will lose the icon.

3 REPLIES 3

rderewianko
Valued Contributor II

I iconize a folder with the following script

#!/usr/bin/env python
import Cocoa
import sys

Cocoa.NSWorkspace.sharedWorkspace().setIcon_forFile_options_(Cocoa.NSImage.alloc().initWithContentsOfFile_(sys.argv[1].decode('utf-8')), sys.argv[2].decode('utf-8'), 0) or sys.exit("Unable to set file icon")

Gist

Executing by running:

python set-image.py "locationtopngyouwanttouse.png" fulllistingtofolder

eg

python set-image.py Office-2016-Office.png /Applications/Microsoft Office 2016/

AVmcclint
Honored Contributor

I had that happen to me once. Within Composer, make sure the permissions on the icon file are set to Read for all.

whitebeer
Contributor

I came along this question and tried out the idea of @AVmcclint. It also worked out for me! 👍
The problem was that I removed the icon-file from the created package in Composer.
b97cf5d312644890b228949ca765b226
I added the picture with copy-paste method in the Finder > Information window.
So just open the picture, copy and paste it on the Foldericon. After that I checked the privileges in Composer, the Icon file is not present for the users but works as folder icon 🙂