digitalmars.D.learn - Getting user home directory
- Lorenzo Villani <arbiter beyond-linux.org> Apr 07 2007
- "Unknown W. Brackets" <unknown simplemachines.org> Apr 07 2007
- "Jarrett Billingsley" <kb3ctd2 yahoo.com> Apr 08 2007
- Lorenzo Villani <arbiter beyond-linux.org> Apr 08 2007
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 :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









"Unknown W. Brackets" <unknown simplemachines.org> 