[Issue 278] New: dmd.conf search path dosn't work

BCS BCS at pathlink.com
Tue Aug 8 12:32:22 PDT 2006


Bruno Medeiros wrote:
> Sean Kelly wrote:
> 
>>
>> I was being lazy and trying to avoid starting my Linux VM :-)  But I 
>> just wrote an app like the above, compiled it as "app", moved the 
>> executable to /dmd/bin, and ran it.  As suspected, argv[0] was "app" 
>> and not "/dmd/bin/app" as the DMD front-end seems to expect.  I also 
>> couldn't find a built-in way to determine the location of the 
>> executing process, so it may be that DMD will have to iterate across 
>> the PATH list as Build does.
>>
>>
>> Sean
> 
> 
> When argv[0] isn't an absolute path, then isn't the location of the 
> executing process file =  CWD ~ argv[0] ?
> 

You will also have to search the path to find it. argv[0] seems to be 
whatever you used to call the program put something on the path and run 
it without a full path you will get the name you typed in


<code name="test.d">
import std.stdio;
void main(char[][] argv){foreach(i,a;argv)writef("%d:>\"%s\"\n",i,a);}
</code>

// put in path at /bin/foo/
$test
0:>"test"

// call directly
$/bin/foo/test
0:>"/bin/foo/test"

// call locally
$./test
0:>"./test"

Seems to be a direct mapping to whater exec was given.



More information about the Digitalmars-d-bugs mailing list