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

后端 未结 7 504
予麋鹿
予麋鹿 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:24

    http://developer.apple.com/documentation/Carbon/Reference/Process_Manager/Reference/reference.html#//apple_ref/c/func/GetProcessBundleLocation

    GetProcessBundleLocation seems to work.

提交回复
热议问题