www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Getting user home directory

reply Lorenzo Villani <arbiter beyond-linux.org> writes:
A simple question, is it possible to get the user home directory using a D
function or something? Thanks :D
Apr 07 2007
next sibling parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
Well, you can use getenv(), which is in std.c.stdlib (you'll have to use 
toStringz().)  You'd just want the "HOME" variable.

Note that on Windows, the closest match would probably be USERPROFILE or 
APPDATA.  If you care about Windows.

-[Unknown]


 A simple question, is it possible to get the user home directory using a D
function or something? Thanks :D
Apr 07 2007
prev sibling next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Lorenzo Villani" <arbiter beyond-linux.org> wrote in message 
news:ev8q4s$ed$1 digitalmars.com...
A simple question, is it possible to get the user home directory using a D 
function or something? Thanks :D
Another way would be to use the std.path.expandTilde function, i.e. import std.path; ... char[] rsrcDir = std.path.expandTilde("~/myresources"); And it'll get you the path within the user's home directory.
Apr 08 2007
prev sibling parent Lorenzo Villani <arbiter beyond-linux.org> writes:
Thanks a lot! :D
Apr 08 2007