[llvm-commits] [llvm] r118505 - in /llvm/trunk/lib/System/Win32: Path.inc Win32.h

Michael J. Spencer bigcheesegs at gmail.com
Tue Nov 9 07:11:20 PST 2010


Author: mspencer
Date: Tue Nov  9 09:11:19 2010
New Revision: 118505

URL: http://llvm.org/viewvc/llvm-project?rev=118505&view=rev
Log:
System/Path/Windows: Make GetSystemLibraryPaths more generic.

Modified:
    llvm/trunk/lib/System/Win32/Path.inc
    llvm/trunk/lib/System/Win32/Win32.h

Modified: llvm/trunk/lib/System/Win32/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Path.inc?rev=118505&r1=118504&r2=118505&view=diff
==============================================================================
--- llvm/trunk/lib/System/Win32/Path.inc (original)
+++ llvm/trunk/lib/System/Win32/Path.inc Tue Nov  9 09:11:19 2010
@@ -240,8 +240,32 @@
 
 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

Modified: llvm/trunk/lib/System/Win32/Win32.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Win32.h?rev=118505&r1=118504&r2=118505&view=diff
==============================================================================
--- llvm/trunk/lib/System/Win32/Win32.h (original)
+++ llvm/trunk/lib/System/Win32/Win32.h Tue Nov  9 09:11:19 2010
@@ -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>
 





More information about the llvm-commits mailing list