Finding the D compiler programatically.
Hasan Aljudy
hasan.aljudy at gmail.com
Tue Mar 6 18:07:40 PST 2007
Searching %PATH% is your only option, but even that theoretically
doesn't suffice, for all you know, the user could have his dmd renamed
to dlang.exe dcomp.exe or something not even remotely related to d, like
euiDEfpD3dW.exe :)
or, maybe dmd.exe isn't even in %PATH%; maybe the user has a python
script that he invokes to compile his projects (in this case, the script
will be the one that knows the real path to dmd).
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.
>
More information about the Digitalmars-d
mailing list