Programmatically retrieving the absolute path of an OS X command-line app

后端 未结 7 466
予麋鹿
予麋鹿 2020-11-27 15:04

On Linux, an application can easily get its absolute path by querying /proc/self/exe. On FreeBSD, it\'s more involved, since you have to build up a sysctl call

相关标签:
7条回答
  • 2020-11-27 15:32

    This is late, but [[NSBundle mainBundle] executablePath] works just fine for non-bundled, command-line programs.

    0 讨论(0)
提交回复
热议问题