OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/win_util.h" | 13 #include "base/win/windows_version.h" |
14 | 14 |
15 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx | 15 // http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
16 extern "C" IMAGE_DOS_HEADER __ImageBase; | 16 extern "C" IMAGE_DOS_HEADER __ImageBase; |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 | 19 |
20 bool PathProviderWin(int key, FilePath* result) { | 20 bool PathProviderWin(int key, FilePath* result) { |
21 | 21 |
22 // We need to go compute the value. It would be nice to support paths with | 22 // We need to go compute the value. It would be nice to support paths with |
23 // names longer than MAX_PATH, but the system functions don't seem to be | 23 // names longer than MAX_PATH, but the system functions don't seem to be |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return false; | 79 return false; |
80 cur = FilePath(system_buffer); | 80 cur = FilePath(system_buffer); |
81 break; | 81 break; |
82 case base::DIR_PROFILE: | 82 case base::DIR_PROFILE: |
83 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, | 83 if (FAILED(SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, |
84 system_buffer))) | 84 system_buffer))) |
85 return false; | 85 return false; |
86 cur = FilePath(system_buffer); | 86 cur = FilePath(system_buffer); |
87 break; | 87 break; |
88 case base::DIR_LOCAL_APP_DATA_LOW: | 88 case base::DIR_LOCAL_APP_DATA_LOW: |
89 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) { | 89 if (win::GetVersion() < win::VERSION_VISTA) { |
90 return false; | 90 return false; |
91 } | 91 } |
92 // TODO(nsylvain): We should use SHGetKnownFolderPath instead. Bug 1281128 | 92 // TODO(nsylvain): We should use SHGetKnownFolderPath instead. Bug 1281128 |
93 if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, | 93 if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, |
94 system_buffer))) | 94 system_buffer))) |
95 return false; | 95 return false; |
96 cur = FilePath(system_buffer).DirName().AppendASCII("LocalLow"); | 96 cur = FilePath(system_buffer).DirName().AppendASCII("LocalLow"); |
97 break; | 97 break; |
98 case base::DIR_LOCAL_APP_DATA: | 98 case base::DIR_LOCAL_APP_DATA: |
99 if (FAILED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, | 99 if (FAILED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, |
(...skipping 19 matching lines...) Expand all Loading... |
119 } | 119 } |
120 default: | 120 default: |
121 return false; | 121 return false; |
122 } | 122 } |
123 | 123 |
124 *result = cur; | 124 *result = cur; |
125 return true; | 125 return true; |
126 } | 126 } |
127 | 127 |
128 } // namespace base | 128 } // namespace base |
OLD | NEW |