【问题标题】:Changing icon of package created by package maker更改包制造商创建的包图标
【发布时间】:2010-06-03 06:56:44
【问题描述】:

我使用 packagemaker ver 3.0.4 创建了包 (.pkg) 文件。是否可以为 .pkg 文件提供自定义图标。有人可以帮助我如何做到这一点吗? 提前致谢。

【问题讨论】:

    标签: cocoa xcode macos packagemaker


    【解决方案1】:

    【讨论】:

    • 我不确定这是否仍然适用于雪豹。对我不起作用。
    • 独角兽:是的。它在 10.6.3 之前一直运行良好。确保放置 pkg 的位置以及 pkg 本身是可写的。
    • 哦,是的,它对我有用。在不正确的地方做。非常感谢您提供的信息。但现在的问题是当我再次创建包时,这个图标会改变。是否可以将此图标文件添加到 pmdoc 本身,以便在从中创建包时,它将具有自定义图标?
    • 我不知道。您必须通过其他方式将其自动化,例如通过 AppleScript 或通过对 SetFile(1) 命令编写 shell 脚本。后一种解决方案包括将图标放入 .pkg 内的 IconFamily (.icns) 格式的文件中,文件名为“Icon\r”(“Icon”后跟回车符,ASCII 0x0d),并使用 SetFile 给出.pkg 自定义图标位并带走其初始位。
    • 帮了大忙,我现在就试试这个。
    【解决方案2】:
    Setting an icon for an mpkg, works fine
    
    # create a file that actually going to set the icon file
    touch <package_name>.mpkg/Icon$'\r'
    
    # --- copy the customIcon.icns file to the <package_name>.mpkg before doing the sips, if its needed you 
    # can take a copy of the file before doing the sips command, doing on a copied file will do good
    
    
    sips -i <package_name>.mpkg/customIcon.icns
    DeRez -only icns <package_name>.mpkg/customIcon.icns > tmpIcon.rsrc
    Rez -append tmpIcon.rsrc -o $'<package_name>.mpkg/Icon\r'
    SetFile -a C <package_name>.mpkg
    
    
    # removing the tmp file
    rm tmpIcon.rsrc
    
    # remove the .icns from mpkg                
    rm <package_name>.mpkg/customIcon.icns
    
    # if you want you can hide the Icon$'\r' file inside the .mpkg file, file that presently sets the icon 
    SetFile -a V <package_name>.mpkg/Icon$'\r'
    
    
    Hope this helps.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-26
      • 1970-01-01
      • 1970-01-01
      • 2019-06-29
      • 1970-01-01
      • 2014-09-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多