FROM : Antti Karanta
DATE : Mon Nov 19 17:24:40 2007
On Mon, 19 Nov 2007 18:12:23 +0200, I. Savant
<<email_removed>> wrote:
>> I would need to find out the directory where the current executable
>> resides to find some stuff whose location I know relative to the
>> executable location.
>
> The first argument ( argv[0] ) is the path to your executable.
On other systems (at least on windows and AFAIK on linux / solaris as
well) argv[0] is the string how the program was invoked. This is
different; if the program was invoked with full or relative path, then I
can get the info I want. However, if the program is found on PATH argv[0]
is pretty useless. Ok, I could replicate the functionality of "which"
command to find out where the program was, but this seems clumsy.
Or is this different on os-x so that argv[0] always contains the full
path to the executable?
-Antti-
DATE : Mon Nov 19 17:24:40 2007
On Mon, 19 Nov 2007 18:12:23 +0200, I. Savant
<<email_removed>> wrote:
>> I would need to find out the directory where the current executable
>> resides to find some stuff whose location I know relative to the
>> executable location.
>
> The first argument ( argv[0] ) is the path to your executable.
On other systems (at least on windows and AFAIK on linux / solaris as
well) argv[0] is the string how the program was invoked. This is
different; if the program was invoked with full or relative path, then I
can get the info I want. However, if the program is found on PATH argv[0]
is pretty useless. Ok, I could replicate the functionality of "which"
command to find out where the program was, but this seems clumsy.
Or is this different on os-x so that argv[0] always contains the full
path to the executable?
-Antti-






Cocoa mail archive

