Lion OSX 上 .pkg 文件的自定义图标

发布于 2024-12-22 03:48:30 字数 873 浏览 0 评论 0原文

我已经使用 PackageMaker 创建了一个包,并且想要更改 .pkg 文件的默认图标。 经过一番谷歌搜索后,这里的 seticon 实用程序 http://sveinbjorn.org/osxutils_docs 解决了我所有 OSX 的问题 -除最新的 Lion 10.7(内核 11.0.0)外。默认图标已替换为对双击不敏感的灰色方块,看起来像损坏的文件关联。

另外两天的谷歌搜索让我了解了一些有关资源分支、SetFile(1) 和其他一些有用的人员的知识,例如这个旧线程 更改包制造商创建的包的图标但仍然没有运气。

我正在尝试做类似的事情:

目标=pack.pkg

icon_filename="$(perl -e '打印"图标\r"')"

触摸“$target/..namedfork/rsrc/$icon_filename”

cp“Icon.icns”“$target/..namedfork/rsrc/$icon_filename”

/Developer/Tools/SetFile -a C "$target"

并获取: build-Mac:pack.pkg/..namedfork/ 不是目录。

我做错了什么?有谁能告诉我 Lion 中资源分叉的区别吗?还有其他可用脚本的解决方案吗?

请注意,我是 MAC 方面的新手,希望为傻瓜提供详细的答案。

I have created a package using PackageMaker and want to change the default icon for .pkg file.
After some googling, seticon utility from here http://sveinbjorn.org/osxutils_docs solved my problem for all OSX-es except the latest Lion 10.7 (Kernel 11.0.0). The default icon was replaced by grey square insensitive for double clicks, looks like broken file association.

Additional two days googling gave me some knowledge about resource fork, SetFile(1) and some other useful staff like this old thread Changing icon of package created by package maker but still no luck.

I am trying to do something like:

target=pack.pkg

icon_filename="$(perl -e 'print "Icon\r"')"

touch "$target/..namedfork/rsrc/$icon_filename"

cp "Icon.icns" "$target/..namedfork/rsrc/$icon_filename"

/Developer/Tools/SetFile -a C "$target"

and getting:
build-Mac:pack.pkg/..namedfork/ not a directory.

What am I doing wrong? Does anyone can tell me the difference in resource fork in Lion? Any other script-able solution?

Please note, I am a total newbie in MACs and will appreciate a detailed answer for dummies.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花期渐远 2024-12-29 03:48:30

终于想出来了,放在这里,以备不时之需的人。我使用苹果脚本:

set newIcon to (POSIX file "IconMac.icns") as alias
set theItem to (POSIX file "Installer.pkg") as alias

tell application "Preview"
activate
open newIcon
end tell
tell application "System Events"
tell process "Preview"
    keystroke "c" using command down
end tell
end tell
tell application "Preview" to quit

tell application "Finder"
set infoWindow to open information window of theItem
set infoWindowName to name of infoWindow
end tell

tell application "System Events"
tell application process "Finder"
    tell window infoWindowName
        keystroke tab
        delay 1
        keystroke "v" using command down
    end tell
end tell
end tell

tell application "Finder"
close infoWindow
end tell

I have finally figured out it, in case of someone need it, putting it here. I used apple script:

set newIcon to (POSIX file "IconMac.icns") as alias
set theItem to (POSIX file "Installer.pkg") as alias

tell application "Preview"
activate
open newIcon
end tell
tell application "System Events"
tell process "Preview"
    keystroke "c" using command down
end tell
end tell
tell application "Preview" to quit

tell application "Finder"
set infoWindow to open information window of theItem
set infoWindowName to name of infoWindow
end tell

tell application "System Events"
tell application process "Finder"
    tell window infoWindowName
        keystroke tab
        delay 1
        keystroke "v" using command down
    end tell
end tell
end tell

tell application "Finder"
close infoWindow
end tell
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文