且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在没有终端窗口的情况下启动Mac应用程序

更新时间:2022-05-02 22:09:15

Mac二进制文件设置为使用终端"程序打开;除了制作一个完整的应用程序包,或者让另一个程序通过system或类似的程序启动它之外,没有其他解决办法.

Mac binaries are set to be opened with the 'Terminal' program; there's no way around that, except by making a full application package, or have another program launch it via system or something like that.

双击二进制文件时,将打开终端窗口,并以~作为当前目录.建议您首先在程序中使用chdir(2),以确保它在正确的目录中运行.

When double-clicking on a binary, the terminal window opens with ~ as the current directory. I suggest you use chdir(2) in your program to ensure it is running in the right directory if you need it in the first place.