2011-12-20 100 views
2

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

另外两天谷歌搜索给了我关于资源分叉,SetFile(1)和其他一些有用的工作人员,像这个老线程Changing icon of package created by package maker但仍然没有运气的一些知识。

我试图做这样的事情:

目标= pack.pkg

icon_filename = “$(perl的-e '打印 ”图标\ R“')”

触摸“$目标/ .. namedfork/RSRC/$ icon_filename”

CP “Icon.icns” “$目标/ .. namedfork/RSRC/$ icon_filename”

/开发/ T ools/SetFile -a C“$ target”

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

我在做什么错?有谁能告诉我狮子资源分歧的不同吗?任何其他脚本解决方案?

请注意,我是一个MAC新手,并会欣赏假人的详细答案。

回答

1

我终于想通了,如果有人需要它,把它放在这里。我用苹果脚本:

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