On 2019-08-03 17:58, Jonathan M Davis wrote:
Also, the first element in the array passed to main is the name of the executable.
No, what's passed to "main" is the path to however the application was invoked, not the executable. If you invoke it as "./foo" it will pass "./foo" to the "main" function. If you invoke it as "/usr/local/bin/foo" it will pass "/usr/local/bin/foo" to the "main" function. That's at least how it works on macOS.
"thisExePath" will give you the full path to the executable regardless how if it was invoked. It will resolve symlinks as well.
So it depends on what's needed. "name of application" is a bit diffuse statement.
-- /Jacob Carlborg