Finding the D compiler programatically.
Bill Baxter
dnewsgroup at billbaxter.com
Tue Mar 6 19:50:32 PST 2007
Andrei Alexandrescu (See Website For Email) wrote:
> Nathan Petrelli wrote:
>> My program needs to call DMD / GDC to compile a generated class. So,
>> how can I find where the user installed it's dmd.exe / gdc on windows
>> and linux?
>>
>> Right now I'm checking the following paths to see if it exists:
>>
>> C:\dmd\bin\dmd.exe
>> C:\Program Files\dmd\bin\dmd.exe
>> any folder in %PATH%
>>
>> and similar algorithm for GDC on linux but it doesn't seems like a
>> very good idea to check all those paths.
>>
>> Is there a better way?
>>
>> Thanks.
>
> The standard method is to not look in hardcoded places, but instead in
> $PATH and then in the $DMD_HOME variable that your documentation publishes.
Speaking of which, can we have a community consensus on what to call
DMD_HOME (and what it should point to)?
I use DMDDIR currently and set it so that $DMDDIR\dmd\bin\dmd.exe works.
I think I started using ***DIR for environment variables at some point
in the past because I saw other projects using it. I can't remember
which now, but at least I think that's what Qt uses (QTDIR).
Anyway, I don't care what it is, as long as it's a community standard
and I can badger anyone who uses a different environment variable.
--bb
More information about the Digitalmars-d
mailing list