douxue7196 2018-06-28 08:24
浏览 287

如何在MacOs中向文件添加版本和版权信息

I am building an executable in GoLang for MacOs. I need to add version and copyright information to the built file. How do I do this during the go build process or afterwards?

For example the iBooks application has this information enter image description here

P.S. I usually build for Windows only where I use Versioninfo format to add file properties but cannot find something equivalent for MacOs

  • 写回答

1条回答 默认 最新

  • dttphb59319 2018-06-28 12:28
    关注

    iBooks is an application bundle, not a single binary like you would build with go. So you would need to find a way of wrapping the go binary in an app bundle in order to get this detail, and if it was applicable to your executable.

    If you right click on the iBooks icon and then select "Show Package Contents", then navigate into the Contents folder you will find (among other files+folders) an Info.plist file and a version.plist file which hold the definition of the copyright and version respectively.

    Info.plist

    ...
    <key>NSHumanReadableCopyright</key>
    <string>Copyright © 2013–2018 Apple Inc. All rights reserved.</string>
    ...
    

    version.plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>BuildAliasOf</key>
        <string>iBooks</string>
        <key>BuildVersion</key>
        <string>1</string>
        <key>CFBundleShortVersionString</key>
        <string>1.14</string>
        <key>CFBundleVersion</key>
        <string>1458.15</string>
        <key>ProjectName</key>
        <string>iBooks</string>
        <key>SourceVersion</key>
        <string>1458015000000000</string>
    </dict>
    </plist>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器