summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-11-09 15:11:31 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-11-09 15:11:31 +0000
commit86cdb427379d0028d9ec5ed56cb374071fb3bdc4 (patch)
tree6c9a1570d061d97977041ef3276d280d6c690aa8 /llvm/lib
parent181fd8cd89ff97fe654fabbb2032e0ad6607b4d0 (diff)
downloadbcm5719-llvm-86cdb427379d0028d9ec5ed56cb374071fb3bdc4.tar.gz
bcm5719-llvm-86cdb427379d0028d9ec5ed56cb374071fb3bdc4.zip
System/Path/Windows: Generalize GetUserHomeDirectory.
llvm-svn: 118506
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/System/Win32/Path.inc17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc
index 9187c827938..b0cca0e3362 100644
--- a/llvm/lib/System/Win32/Path.inc
+++ b/llvm/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
OpenPOWER on IntegriCloud