Mac OS X: 文件图标制作和变更(Resource Fork)

本文介绍了如何在MacOS系统中自定义文件、文件夹及磁盘卷的图标,包括使用ResourceFork存储图标信息,通过命令行工具进行图标更新的具体步骤。

Mac OS X: 文件图标变更(Resource Fork)

在Mac系统里面,文件的一些属性是存储在Resource Fork里面的,这个在其它的系统里面基本上是没有的,是Mac系统的特点。

Resource Fork是存储文件结构化数据的存储方式,是和Data Fork相对比而言的, Data Fork就是我们最普通的一个文件的内容的存储方式了。

那么Resource Fork里面到底存储什么呢?其实,如果你开发程序,基本上说,可以存储任何东西,但是造成的问题是,在当今的互联环境里不实用。

而在Mac系统里面,它主要是保存,文件在GUI环境里面显示图标时的图标,窗口形状,程序码等等

这里只说图标-icon. 在GUI环境里面,图标的设定比较容易,比如复制一个图形然后在一个文件的信息窗中粘贴图标旧恶可以了。

下面的方法,也有使用GUI程序的部分,也有使用命令行的部分,命令行适合于管理员的管理和自动化。

# -----------------------------
# For files
# 1. Create a resource fork file (tempfork)
# . From another file using derez command
# . or use icongrapher to save as resource file
# 2. update file resource fold with the tempfork file
# . using rez command
# . or use icongrapher to save into a file
# 3. "setfile -a C" command
# -----------------------------
derez -only icns sourcefile > tempicns.rsrc
rez -a tempicns.rsrc -o recipienfile
setfile -a C recipienfile

# -----------------------------
# For Folders
#
# 1. (same as the 1. step in For Files)
# 2. copy the tempfork file in the folder
# cp tempfork /folder/Icom^M
# 3. "setfile -a C" command
# -----------------------------
derez -only icns sourcefile > tempicns.rsrc
#cp tempfork TheFolder/Icon^M
setfile -a C TheFolder

# -----------------------------
# For Volumes
# create a .VolumeIcon.icns file in the root of the Volume
# This .icns file is actually a icon file which is save in
# Icon Composer or Preview.
# 3. "setfile -a C" command
# -----------------------------

CandyBar can be used for saving other format pictures to Mac icns

Ref:
http://www.macgeekery.com/gspot/2006-09/copying_a_folders_icon_with_terminal_commands

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值