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 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?