diff options
| author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-11-09 15:11:19 +0000 |
|---|---|---|
| committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-11-09 15:11:19 +0000 |
| commit | 181fd8cd89ff97fe654fabbb2032e0ad6607b4d0 (patch) | |
| tree | dc03a44bd9b53be8f9c302cd588286ec7ebc07b6 /llvm/lib/System | |
| parent | bb6e51c957e3494a7329baa6944cbe3eaaf08fc4 (diff) | |
| download | bcm5719-llvm-181fd8cd89ff97fe654fabbb2032e0ad6607b4d0.tar.gz bcm5719-llvm-181fd8cd89ff97fe654fabbb2032e0ad6607b4d0.zip | |
System/Path/Windows: Make GetSystemLibraryPaths more generic.
llvm-svn: 118505
Diffstat (limited to 'llvm/lib/System')
| -rw-r--r-- | llvm/lib/System/Win32/Path.inc | 28 | ||||
| -rw-r--r-- | llvm/lib/System/Win32/Win32.h | 2 |
2 files changed, 28 insertions, 2 deletions
diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc index 75f6b7134a4..9187c827938 100644 --- a/llvm/lib/System/Win32/Path.inc +++ b/llvm/lib/System/Win32/Path.inc @@ -240,8 +240,32 @@ Path::GetRootDirectory() { void Path::GetSystemLibraryPaths(std::vector<sys::Path>& Paths) { - Paths.push_back(sys::Path("C:/WINDOWS/SYSTEM32")); - Paths.push_back(sys::Path("C:/WINDOWS")); + char buff[MAX_PATH]; + // Generic form of C:\Windows\System32 + HRESULT res = SHGetFolderPathA(NULL, + CSIDL_FLAG_CREATE | CSIDL_SYSTEM, + NULL, + SHGFP_TYPE_CURRENT, + buff); + if (res != S_OK) { + assert(0 && "Failed to get system directory"); + return; + } + Paths.push_back(sys::Path(buff)); + + // Reset buff. + buff[0] = 0; + // Generic form of C:\Windows + res = SHGetFolderPathA(NULL, + CSIDL_FLAG_CREATE | CSIDL_WINDOWS, + NULL, + SHGFP_TYPE_CURRENT, + buff); + if (res != S_OK) { + assert(0 && "Failed to get windows directory"); + return; + } + Paths.push_back(sys::Path(buff)); } void diff --git a/llvm/lib/System/Win32/Win32.h b/llvm/lib/System/Win32/Win32.h index d054812c76c..00a7e75fc2a 100644 --- a/llvm/lib/System/Win32/Win32.h +++ b/llvm/lib/System/Win32/Win32.h @@ -18,10 +18,12 @@ // Require at least Windows 2000 API. #define _WIN32_WINNT 0x0500 +#define _WIN32_IE 0x0500 // MinGW at it again. #define WIN32_LEAN_AND_MEAN #include "llvm/Config/config.h" // Get build system configuration settings #include <Windows.h> +#include <ShlObj.h> #include <cassert> #include <string> |

