Getting environment variables?

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Nov 22 10:23:35 PST 2008


On Sat, Nov 22, 2008 at 12:55 PM, Christopher Wright <dhasenan at gmail.com> wrote:
> Hey all,
>
> How do I get environment variables in a D program? I specifically want the
> path to a user's home folder.
>
> Ta muchly.
>

In Tango, there's tango.sys.Environment
(http://www.dsource.org/projects/tango/docs/current/tango.sys.Environment.html)
which provides a nice interface to environment variables.

In Phobos, I think you have to use the C functions to get at
environment variables, but std.path.expandTilde can be abused to get
the home folder ;)


More information about the Digitalmars-d-learn mailing list