Boost logo

Boost :

Subject: Re: [boost] [filesystem] home_directory_path
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-10-19 08:11:14


Christian Holmquist wrote:
>> You might be better off calling SHGetFolderPath with a CSIDL value like
>>> CSIDL_APPDATA.
>>> http://msdn.microsoft.com/en-us/library/bb762181.aspx
>>> http://msdn.microsoft.com/en-us/library/bb762494.aspx
>>>
>>>
> I think CSIDL_APPDATA is not the correct flag, we're using the following
> args to SHGetFolderPath, and it appears to work
>
> char path[MAX_PATH];
> bool success = SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL |
> CSIDL_FLAG_CREATE, NULL, 0, path))));

CSIDL_PERSONAL corresponds to the user's 'My Documents' folder, whereas
CSIDL_PROFILE corresponds to the user's profile directory which is more
consistent with the POSIX 'HOME' directory.

Also consensus from discussion on temp_directory_path was that the
library should *not* create a directory if one doesn't exist.

Hmm, the other drawback of this function is the lack of ability to get
the buffer size, and no documented error code corresponding to
insufficient buffer size. Is it guaranteed that the buffer size =
MAX_PATH is always sufficient?

> ..and I think this would be a most useful addition to boost::filesystem.

Me too. I've needed this in projects for several different employers
over the years.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk