[PATCH] Introduce llvm::sys::path::home_directory.

Peter Collingbourne peter at pcc.me.uk
Sun Nov 17 14:34:22 PST 2013


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.

Thanks,
-- 
Peter



More information about the llvm-commits mailing list