| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 file_util::UpOneDirectory(&wstring_path); | 98 file_util::UpOneDirectory(&wstring_path); |
| 99 file_util::AppendToPath(&wstring_path, L"LocalLow"); | 99 file_util::AppendToPath(&wstring_path, L"LocalLow"); |
| 100 cur = FilePath(wstring_path); | 100 cur = FilePath(wstring_path); |
| 101 break; | 101 break; |
| 102 case base::DIR_LOCAL_APP_DATA: | 102 case base::DIR_LOCAL_APP_DATA: |
| 103 if (FAILED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, | 103 if (FAILED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, |
| 104 SHGFP_TYPE_CURRENT, system_buffer))) | 104 SHGFP_TYPE_CURRENT, system_buffer))) |
| 105 return false; | 105 return false; |
| 106 cur = FilePath(system_buffer); | 106 cur = FilePath(system_buffer); |
| 107 break; | 107 break; |
| 108 case base::DIR_SOURCE_ROOT: | 108 case base::DIR_SOURCE_ROOT: { |
| 109 FilePath executableDir; |
| 109 // On Windows, unit tests execute two levels deep from the source root. | 110 // On Windows, unit tests execute two levels deep from the source root. |
| 110 // For example: chrome/{Debug|Release}/ui_tests.exe | 111 // For example: chrome/{Debug|Release}/ui_tests.exe |
| 111 PathService::Get(base::DIR_EXE, &cur); | 112 PathService::Get(base::DIR_EXE, &executableDir); |
| 112 cur = cur.DirName().DirName(); | 113 cur = executableDir.DirName().DirName(); |
| 114 FilePath checkedPath = |
| 115 cur.Append(FILE_PATH_LITERAL("base/base_paths_win.cc")); |
| 116 if (!file_util::PathExists(checkedPath)) { |
| 117 // Check for WebKit-only checkout. Executable files are put into |
| 118 // WebKit/WebKit/chromium/{Debug|Relese}, and we should return |
| 119 // WebKit/WebKit/chromium. |
| 120 cur = executableDir.DirName(); |
| 121 } |
| 113 break; | 122 break; |
| 123 } |
| 114 default: | 124 default: |
| 115 return false; | 125 return false; |
| 116 } | 126 } |
| 117 | 127 |
| 118 *result = cur; | 128 *result = cur; |
| 119 return true; | 129 return true; |
| 120 } | 130 } |
| 121 | 131 |
| 122 } // namespace base | 132 } // namespace base |
| OLD | NEW |