Re: OT: scriptually? create custom folder icon
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On 15 Dec 2009, at 10:11, Mo McRoberts wrote:
On 15-Dec-2009, at 10:07, Geoff Lee wrote:
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):
Fantastic. I had never noticed the Rez tool before: it's exactly what I need. Thanks a lot! -geoff
#! /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: mo.mcroberts@me.com Jabber/GTalk: mo@ilaven.net Twitter: @nevali
Run Leopard or Snow Leopard? Set Quick Look free with DropLook - http://labs.jazzio.com/DropLook/
______________________________________ Geoff Lee <G.Lee@ed.ac.uk> Computing Support School of Arts, Culture and Environment University of Edinburgh 20 Chambers St, Edinburgh, Scotland, EH1 1JZ Tel: +44 (0)131 650 2341 ______________________________________ -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Geoff Lee