|
Boost : |
Subject: [boost] [filesystem] home_directory_path
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-10-18 10:58:31
In looking at implementing a portable home_directory_path function a few
questions arise.
Based on http://en.wikipedia.org/wiki/Home_directory, POSIX and other
UNIX flavors 'appear' to be a straight forward use of the "HOME"
environment variable. Does anyone have any experience where the "HOME"
variable is not the proper source of the user's home directory?
Windows NT and above have the "USERPROFILE" environment variable. Using
this would be the easiest to use. But I've seen discussion that this may
not always be properly defined, in particular if the user has reset
their home directory to a non-system drive. I haven't tracked down it's
availability on WinCE. Does anyone have experience with this platform?
There is the windows GetUserProfileDirectory api function also available
since NT4. This is in the Userenv.lib/dll, obviously adding a link
dependancy. How are these sorts of system link dependencies handled?
Through bjam? Or is it acceptable/better to use #pragma
comment(lib,"Userenv.lib")?
In looking at some client code using home_directory_path, I see that
they generally are looking for the user's Desktop directory(Mac &
Windows). Obviously this only makes sense on GUI platforms. The issue
with merely getting this path via home_directory_path() / "Desktop" is
IIRC, that at least on windows "Desktop" is localized and may not exist
with that name on non-english localized systems. Windows has the
SHGetFolderPath api. I need to look into Mac's native support. Any
thoughts on the general usefulness of a portable desktop_directory_path?
Thanks, Jeff
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk