将版本信息添加到 OSX 命令行应用程序
在 Windows 上,我只需添加一个包含正确数据的 RC 文件即可。我是否需要像往常一样使用 info.plist/version.plist 组装一个捆绑包,或者是否有更好的、标准的做事方式?这是针对 Snow Leopard 的,如果相关的话,以后也可以。
谢谢++
On Windows I'd simply add an RC file with the right data. Do I need to assemble a bundle as usual with an info.plist/version.plist or is there a better, standard, way of doing things? This is for Snow Leopard and later if that is relevant.
Thx++
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以将 Info.plist 文件作为特殊的 Mach-o 部分嵌入到可执行文件中。例如,请参阅此问题。
It is possible to embed an Info.plist file in an executable as a special Mach-o section. See for example this question.
如果您有命令行应用程序,那么它只是一个文件,而不是传统的 OSX 应用程序包(下面有一个 Contents 文件夹和一个 MacOS + Resources 文件夹)。
如果您不愿意制作一个完整的 Macintosh 应用程序包(带有 GUI 和嵌入其中的 info.plist),我见过 Macintosh 上的命令行应用程序做了一些不同的事情。
1)
为版本添加“-v”选项。因此,如果您的应用程序名为 foo,则在命令行中输入“
foo -v
”会显示“version 1.0
”的输出。2)
将版本号作为文件名的一部分...所以“foo”实际上是“foo1.0”。
哦,这看起来很笨拙。所以...
3)
一些应用程序有一个指向真正的二进制文件的符号链接。所以
foo
指向foo1.0
并且如果你要执行“ls -l”,你会看到类似的内容:所以在命令中输入“foo”行实际上会运行 foo1.0。
希望这些意见对您有所帮助!
If you have a command line application, then it's just a single file and not a traditional OSX app package (with a Contents folder and a MacOS + Resources folder underneath).
If you're not willing to do a full blown Macintosh application package (with a GUI and an info.plist embedded somewhere in there), there are a few different things I've seen done with command line apps on the Macintosh.
1)
Add a "-v" option for version. So if you app is named foo, typing in "
foo -v
" at the command line shows an output of "version 1.0
".2)
Put the version number in as part of the filename... so "foo" is actually "foo1.0".
Oof, that seems clunky. So...
3)
Some apps have a symbolic link pointing to the real binary. So
foo
points tofoo1.0
and if you were to do a "ls -l", you'd see something like:so typing in "foo" at the command line would actually run foo1.0.
I hope these opinions help you out!