Christopher Wright 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.

I think the 'correct' way on Windows is to use SHGetSpecialFolderPathA.

Something like this:

char[MAX_PATH] buf;
SHGetSpecialFolderPathA(null, buf.ptr, CSIDL_PERSONAL, false);
char[] dir = toString(buf.ptr);

or CSIDL_APPDATA, etc.

Reply via email to