[PATCH] Introduce llvm::sys::path::home_directory.
Aaron Ballman
aaron at aaronballman.com
Mon Nov 18 05:18:58 PST 2013
On Sun, Nov 17, 2013 at 5:34 PM, Peter Collingbourne <peter at pcc.me.uk> wrote:
> On Sun, Nov 17, 2013 at 03:21:03PM -0500, Aaron Ballman wrote:
>> > +bool home_directory(SmallVectorImpl<char> &result) {
>> > + if (char *RequestedDir = getenv("HOME")) {
>> > + result.append(RequestedDir, RequestedDir + strlen(RequestedDir));
>>
>> This behavior differs from the Windows implementation in that it's
>> appending to the results instead of replacing them.
>
> Changed.
>
>> > + if (::SHGetFolderPathW(0, CSIDL_APPDATA | CSIDL_FLAG_CREATE, 0,
>> > + SHGFP_TYPE_CURRENT, Path) != S_OK)
>>
>> You shouldn't be passing CSIDL_FLAG_CREATE here; if the user has no
>> home directory, it should fail as in the unix case.
>
> Is it even possible to have no app data directory on Windows? The flag is
> there to handle the case where the user has a path for the directory but the
> directory doesn't exist. I dimly recall reading that this was necessary,
> but maybe it isn't. I guess so many things use this directory on Windows
> that this becomes somewhat of an edge case.
It is possible, though unlikely. A better way to think of it, though,
is: would someone who has no home directory on Windows expect LLVM to
create one for them?
~Aaron
More information about the llvm-commits
mailing list