Re: OT: scriptually? create custom folder icon
Re: OT: scriptually? create custom folder icon
- Subject: Re: OT: scriptually? create custom folder icon
- From: Mo McRoberts <email@hidden>
- Date: Tue, 15 Dec 2009 10:11:02 +0000
On 15-Dec-2009, at 10:07, Geoff Lee wrote:
>
> Hi Folks,
>
> Sorry this is a bit off topic but this seems like the kind of place I might find an answer. I want to assign a custom icon to a folder using, ideally, a bit of shell script/perl/python, though I'm not averse to building a little binary if that will do the trick.
You want the Rez and SetFile utilities, which will do it for you.
(a script which I have to do it as part of a build here, adjust ${CONFIGURATION_TEMP_DIR}/icon-resource.icns to suit):
#! /bin/sh
icon="$SCRIPT_INPUT_FILE_0"
target="$SCRIPT_OUTPUT_FILE_0"
REZ=/Developer/usr/bin/Rez
SETFILE=/Developer/usr/bin/SetFile
cp "$icon" ${CONFIGURATION_TEMP_DIR}/icon-resource.icns || exit $?
echo "read 'icns' (-16455) \"icon-resource.icns\";" > ${CONFIGURATION_TEMP_DIR}/icon-resource.r
ifile="`printf \"$target/Icon\r\"`"
$REZ -o "$ifile" ${CONFIGURATION_TEMP_DIR}/icon-resource.r || exit $?
rm -f ${CONFIGURATION_TEMP_DIR}/icon-resource.icns
rm -f ${CONFIGURATION_TEMP_DIR}/icon-resource.r
$SETFILE -a C "$target"
$SETFILE -a V "$ifile"
Cheers,
Mo.
--
mo mcroberts
http://nevali.net
iChat: email@hidden Jabber/GTalk: email@hidden Twitter: @nevali
Run Leopard or Snow Leopard? Set Quick Look free with DropLook - http://labs.jazzio.com/DropLook/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden