File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
src/com/inet/gradle/setup/dmg/template/dmgbuild Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ # Sets an icon on file or directory
3+ # Usage setIcon.sh iconimage.jpg /path/to/[file|folder]
4+ # see https://stackoverflow.com/questions/8371790/how-to-set-icon-on-file-or-directory-using-cli-on-os-x
5+
6+ iconSource=$1
7+ iconDestination=$2
8+ icon=/tmp/` basename " $iconSource " `
9+ rsrc=/tmp/icon.rsrc
10+
11+ # Create icon from the iconSource
12+ cp " $iconSource " " $icon "
13+
14+ # Add icon to image file, meaning use itself as the icon
15+ sips -i " $icon "
16+
17+ # Take that icon and put it into a rsrc file
18+ DeRez -only icns " $icon " > " $rsrc "
19+
20+ # Apply the rsrc file to
21+ SetFile -a C " $iconDestination "
22+
23+ if [ -f " $iconDestination " ]; then
24+ # Destination is a file
25+ Rez -append " $rsrc " -o " $iconDestination "
26+ elif [ -d " $iconDestination " ]; then
27+ # Destination is a directory
28+ # Create the magical Icon\r file
29+ touch " $iconDestination /$'Icon\r'"
30+ Rez -append " $rsrc " -o " $iconDestination /Icon?"
31+ SetFile -a V " $iconDestination /Icon?"
32+ fi
33+
34+ # Sometimes Finder needs to be reactivated
35+ # osascript -e 'tell application "Finder" to quit'
36+ # osascript -e 'delay 2'
37+ # osascript -e 'tell application "Finder" to activate'
38+
39+ rm " $rsrc " " $icon "
You can’t perform that action at this time.
0 commit comments