[英]Versioning Binaries on OSX
I have a C program that I build using Makefiles on OS X and I'd like to add the version/build number so that it is included in any crash reports. 我有一个在OS X上使用Makefile构建的C程序,我想添加版本/内部版本号,以便它包含在任何崩溃报告中。 How can this be done without putting the binary as part of an app bundle?
如果不将二进制文件作为应用程序捆绑包的一部分怎么办?
As you may have realised, the standard OSX method is to create a bundle and add the version in the Info.plist and there isn't the usual attributes available within the binary executable, as you'd find in Windows. 您可能已经意识到,标准的OSX方法是创建一个包并将版本添加到Info.plist中,而二进制可执行文件中没有通常可用的属性,就像您在Windows中所能找到的那样。
Many terminal apps will allow you to discover their version with a -v option, but this is usuallly just a function returning the version number. 许多终端应用程序允许您使用-v选项来发现其版本,但这通常只是返回版本号的函数。
If you want to add meta data without hard coding it, you could use the extended file attributes to store the version number, which you can read, write and view with the xattr command . 如果要添加元数据而不进行硬编码,则可以使用扩展文件属性来存储版本号,您可以使用xattr命令对其进行读取,写入和查看。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.