site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com 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: 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/ _______________________________________________ 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