[Issue 278] New: dmd.conf search path dosn't work
Brad Roberts
braddr at puremagic.com
Sat Aug 5 12:25:55 PDT 2006
Walter Bright wrote:
> Frank Benoit wrote:
>>> I see, that explains why it worked for me (I used direct path names).
>>
>> The "executable" name can also be a symbolic link.
>>
>> ln -s /home/frank/dmd/bin/dmd ./lnk
>> ./lnk
>>
>>
>> Arg 0 show up with "./lnk". So it is necessary to follow those symbolic
>> links.
>
> I'm rather unfamiliar with that, any snippet of code available?
In the case of creating a symlink to dmd (or any other application), I'd
suggest that the directory of the link be used in preference to the
location of the other end of the link. Add another check ahead of the
binaries location:
...
# check directory with argv0
if [ -e dirname($argv0)/dmd.conf ]; then
return dirname($argv0)/dmd.conf;
# check directory of the source of the link, if it is a link
elif [ -l $argv0 && -e dirname(readlink($argv0))/dmd.conf ]; then
return dirname(readlink($argv0));
# continue with other checks...
elif ...
Sorry for the pseudo shell code, but the equivalent c code isn't much
different.
More information about the Digitalmars-d-bugs
mailing list