代码之家  ›  专栏  ›  技术社区  ›  Unicorn

更改包生成器创建的包的图标

  •  3
  • Unicorn  · 技术社区  · 16 年前

    我使用Packagemaker 3.0.4版创建了包(.pkg)文件。是否可以为.pkg文件提供自定义图标。有人能帮我怎么做吗? 事先谢谢。

    2 回复  |  直到 14 年前
        2
  •  3
  •   Rekha    14 年前
    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.