diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-11-09 15:11:31 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-11-09 15:11:31 +0000 |
commit | 05283c2a2b3b68666cc137accbb87857c34e3872 (patch) | |
tree | 7ab3f273e481bc58e57274247e40489d4eaa91f5 /lib/System/Win32 | |
parent | eebe970c36cbc571910587bfc2efbd3bec47a9ff (diff) | |
download | external_llvm-05283c2a2b3b68666cc137accbb87857c34e3872.zip external_llvm-05283c2a2b3b68666cc137accbb87857c34e3872.tar.gz external_llvm-05283c2a2b3b68666cc137accbb87857c34e3872.tar.bz2 |
System/Path/Windows: Generalize GetUserHomeDirectory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118506 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Win32')
-rw-r--r-- | lib/System/Win32/Path.inc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index 9187c82..b0cca0e 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -293,14 +293,15 @@ Path::GetLLVMDefaultConfigDir() { Path Path::GetUserHomeDirectory() { - // TODO: Typical Windows setup doesn't define HOME. - const char* home = getenv("HOME"); - if (home) { - Path result; - if (result.set(home)) - return result; - } - return GetRootDirectory(); + char buff[MAX_PATH]; + HRESULT res = SHGetFolderPathA(NULL, + CSIDL_FLAG_CREATE | CSIDL_APPDATA, + NULL, + SHGFP_TYPE_CURRENT, + buff); + if (res != S_OK) + assert(0 && "Failed to get user home directory"); + return Path(buff); } Path |