Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: base/files/file_util_win.cc

Issue 2889663004: [DO NOT COMMIT][Offline Pages] Moving Offline Page Cache to cache directory.
Patch Set: again? Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_model_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/files/file_util.h" 5 #include "base/files/file_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <io.h> 8 #include <io.h>
9 #include <psapi.h> 9 #include <psapi.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 if (fileattr != INVALID_FILE_ATTRIBUTES) 276 if (fileattr != INVALID_FILE_ATTRIBUTES)
277 return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0; 277 return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0;
278 return false; 278 return false;
279 } 279 }
280 280
281 bool GetTempDir(FilePath* path) { 281 bool GetTempDir(FilePath* path) {
282 wchar_t temp_path[MAX_PATH + 1]; 282 wchar_t temp_path[MAX_PATH + 1];
283 DWORD path_len = ::GetTempPath(MAX_PATH, temp_path); 283 DWORD path_len = ::GetTempPath(MAX_PATH, temp_path);
284 if (path_len >= MAX_PATH || path_len <= 0) 284 if (path_len >= MAX_PATH || path_len <= 0)
285 return false; 285 return false;
286 DWORD long_path_len = ::GetLongPathName(temp_path, temp_path, MAX_PATH);
287 if (long_path_len >= MAX_PATH || long_path_len <= 0)
288 return false;
286 // TODO(evanm): the old behavior of this function was to always strip the 289 // TODO(evanm): the old behavior of this function was to always strip the
287 // trailing slash. We duplicate this here, but it shouldn't be necessary 290 // trailing slash. We duplicate this here, but it shouldn't be necessary
288 // when everyone is using the appropriate FilePath APIs. 291 // when everyone is using the appropriate FilePath APIs.
289 *path = FilePath(temp_path).StripTrailingSeparators(); 292 *path = FilePath(temp_path).StripTrailingSeparators();
290 return true; 293 return true;
291 } 294 }
292 295
293 FilePath GetHomeDir() { 296 FilePath GetHomeDir() {
294 char16 result[MAX_PATH]; 297 char16 result[MAX_PATH];
295 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, 298 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT,
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 // Like Move, this function is not transactional, so we just 868 // Like Move, this function is not transactional, so we just
866 // leave the copied bits behind if deleting from_path fails. 869 // leave the copied bits behind if deleting from_path fails.
867 // If to_path exists previously then we have already overwritten 870 // If to_path exists previously then we have already overwritten
868 // it by now, we don't get better off by deleting the new bits. 871 // it by now, we don't get better off by deleting the new bits.
869 } 872 }
870 return false; 873 return false;
871 } 874 }
872 875
873 } // namespace internal 876 } // namespace internal
874 } // namespace base 877 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_model_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698