intellij-dlanguage / intellij-dlanguage

Intellij Plugin for the D Programming Language
MIT License
326 stars 51 forks source link

Retrieve phobos/druntime paths from dmd #502

Open andre2007 opened 5 years ago

andre2007 commented 5 years ago

https://github.com/intellij-dlanguage/intellij-dlanguage/blob/5f6b91077518ef3e547ba8e50b85da929fda89b0/src/main/java/io/github/intellij/dlanguage/DlangSdkType.java#L58

I learned from here https://github.com/Pure-D/serve-d/issues/61#issuecomment-507039260 dmd gives you the info about phobos/druntime paths. It just needs to be extracted from dmd output.

That means, you only have to point to dmd and every else is determined correct and automatically.

SingingBush commented 5 years ago

Cool, that will make things easier. As long as DMD always does that behaviour. It may be worth keeping our code as a fallback

andre2007 commented 5 years ago

Yes, the old logic should be kept.

More precise, dmd lists the location of the config file

DMD64 D Compiler v2.086.1
Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved written by Walter Bright

Documentation: https://dlang.org/
Config file: /etc/dmd.conf
Usage:
  dmd [<option>...] <file>...

Config file contains the paths to phobos/druntime

[Environment32]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -L-L/usr/lib/i386-linux-gnu -L--export-dynamic

[Environment64]
DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -L-L/usr/lib/x86_64-linux-gnu -L--export-dynamic -fPIC