OLD | NEW |
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 "net/tools/dump_cache/cache_dumper.h" | 5 #include "net/tools/dump_cache/cache_dumper.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 entry->Close(); | 38 entry->Close(); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 // A version of CreateDirectory which supports lengthy filenames. | 42 // A version of CreateDirectory which supports lengthy filenames. |
43 // Returns true on success, false on failure. | 43 // Returns true on success, false on failure. |
44 bool SafeCreateDirectory(const base::FilePath& path) { | 44 bool SafeCreateDirectory(const base::FilePath& path) { |
45 #ifdef WIN32_LARGE_FILENAME_SUPPORT | 45 #ifdef WIN32_LARGE_FILENAME_SUPPORT |
46 // Due to large paths on windows, it can't simply do a | 46 // Due to large paths on windows, it can't simply do a |
47 // CreateDirectory("a/b/c"). Instead, create each subdirectory manually. | 47 // CreateDirectory("a/b/c"). Instead, create each subdirectory manually. |
48 bool rv = false; | |
49 std::wstring::size_type pos(0); | 48 std::wstring::size_type pos(0); |
50 std::wstring backslash(L"\\"); | 49 std::wstring backslash(L"\\"); |
51 | 50 |
52 // If the path starts with the long file header, skip over that | 51 // If the path starts with the long file header, skip over that |
53 const std::wstring kLargeFilenamePrefix(L"\\\\?\\"); | 52 const std::wstring kLargeFilenamePrefix(L"\\\\?\\"); |
54 std::wstring header(kLargeFilenamePrefix); | 53 std::wstring header(kLargeFilenamePrefix); |
55 if (path.value().find(header) == 0) | 54 if (path.value().find(header) == 0) |
56 pos = 4; | 55 pos = 4; |
57 | 56 |
58 // Create the subdirectories individually | 57 // Create the subdirectories individually |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 213 } |
215 | 214 |
216 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used, | 215 void DiskDumper::CloseEntry(disk_cache::Entry* entry, base::Time last_used, |
217 base::Time last_modified) { | 216 base::Time last_modified) { |
218 #ifdef WIN32_LARGE_FILENAME_SUPPORT | 217 #ifdef WIN32_LARGE_FILENAME_SUPPORT |
219 CloseHandle(entry_); | 218 CloseHandle(entry_); |
220 #else | 219 #else |
221 base::CloseFile(entry_); | 220 base::CloseFile(entry_); |
222 #endif | 221 #endif |
223 } | 222 } |
OLD | NEW |