digitalmars.D.learn - Getting user home directory
- Lorenzo Villani (1/1) Apr 07 2007 A simple question, is it possible to get the user home directory using a...
- Unknown W. Brackets (5/6) Apr 07 2007 Well, you can use getenv(), which is in std.c.stdlib (you'll have to use...
- Jarrett Billingsley (7/9) Apr 08 2007 Another way would be to use the std.path.expandTilde function, i.e.
- Lorenzo Villani (1/1) Apr 08 2007 Thanks a lot! :D
A simple question, is it possible to get the user home directory using a D function or something? Thanks :D
Apr 07 2007
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
"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 :DAnother 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