Finding the D compiler programatically.

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Tue Mar 6 18:43:14 PST 2007


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.


Andrei



More information about the Digitalmars-d mailing list