Find out location of an executable file in Cocoa

前端 未结 5 1778
北恋
北恋 2021-01-05 15:55

The simple question is: how to find out the location of an executable file in a Cocoa application.

Remember that, in many Unix-like OS people use PATH environment t

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-05 16:22

    Isn't the path for Finder (and hence, any GUI-launched Cocoa apps) set from your login shell? If your login shell and the shell you're using in Terminal.app aren't the same, that'd probably lead to some confusion.

    This information might be helpful: http://lists.apple.com/archives/cocoa-dev/2005/Oct/msg00528.html

    Apparently, the "right" way to set environment variables for GUI processes is in a hidden .plist file. I'm sure I knew this at one point, then promptly forgot it.

提交回复
热议问题