| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/base_paths_win.h" | 5 #include "base/base_paths_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 42 break; | 42 break; |
| 43 } | 43 } |
| 44 case base::DIR_WINDOWS: | 44 case base::DIR_WINDOWS: |
| 45 GetWindowsDirectory(system_buffer, MAX_PATH); | 45 GetWindowsDirectory(system_buffer, MAX_PATH); |
| 46 cur = FilePath(system_buffer); | 46 cur = FilePath(system_buffer); |
| 47 break; | 47 break; |
| 48 case base::DIR_SYSTEM: | 48 case base::DIR_SYSTEM: |
| 49 GetSystemDirectory(system_buffer, MAX_PATH); | 49 GetSystemDirectory(system_buffer, MAX_PATH); |
| 50 cur = FilePath(system_buffer); | 50 cur = FilePath(system_buffer); |
| 51 break; | 51 break; |
| 52 case base::DIR_PROGRAM_FILESX86: |
| 53 if (base::win::OSInfo::GetInstance()->architecture() != |
| 54 base::win::OSInfo::X86_ARCHITECTURE) { |
| 55 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILESX86, NULL, |
| 56 SHGFP_TYPE_CURRENT, system_buffer))) |
| 57 return false; |
| 58 cur = FilePath(system_buffer); |
| 59 break; |
| 60 } |
| 61 // Fall through to base::DIR_PROGRAM_FILES if we're on an X86 machine. |
| 52 case base::DIR_PROGRAM_FILES: | 62 case base::DIR_PROGRAM_FILES: |
| 53 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, | 63 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, |
| 54 SHGFP_TYPE_CURRENT, system_buffer))) | 64 SHGFP_TYPE_CURRENT, system_buffer))) |
| 55 return false; | 65 return false; |
| 56 cur = FilePath(system_buffer); | 66 cur = FilePath(system_buffer); |
| 57 break; | 67 break; |
| 58 case base::DIR_IE_INTERNET_CACHE: | 68 case base::DIR_IE_INTERNET_CACHE: |
| 59 if (FAILED(SHGetFolderPath(NULL, CSIDL_INTERNET_CACHE, NULL, | 69 if (FAILED(SHGetFolderPath(NULL, CSIDL_INTERNET_CACHE, NULL, |
| 60 SHGFP_TYPE_CURRENT, system_buffer))) | 70 SHGFP_TYPE_CURRENT, system_buffer))) |
| 61 return false; | 71 return false; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 129 } |
| 120 default: | 130 default: |
| 121 return false; | 131 return false; |
| 122 } | 132 } |
| 123 | 133 |
| 124 *result = cur; | 134 *result = cur; |
| 125 return true; | 135 return true; |
| 126 } | 136 } |
| 127 | 137 |
| 128 } // namespace base | 138 } // namespace base |
| OLD | NEW |