[libcxx-commits] [PATCH] D91175: [19/N] [libcxx] Fix the fallback case in temp_directory_path for windows
Adrian McCarthy via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 7 14:58:01 PST 2020
amccarth requested changes to this revision.
amccarth added inline comments.
This revision now requires changes to proceed.
Comment at: libcxx/src/filesystem/operations.cpp:1599
+ ret = "c:\\windows";
> compnerd wrote:
> > What do you think of using `GetTempPath` instead? That is more likely to be writable.
> That's also an option - or we could skip our own code and just use that one. That function does essentially the same, checks a few env vars (two of the ones checked here, plus USERPROFILE). But if none of the env vars are available, GetTempPath also falls back to c:\windows - that's where I got the idea.
My first choice would be to use GetTempPathW directly, since that will match expectations for Windows programmers and be relatively future proff.
My second choice would be to keep the custom iteration through the well-known environment variables but to replace the hardcoded `c:\windows` with a call to `GetWindowsDirectoryW`.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the libcxx-commits