| 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 "base/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <io.h> | 8 #include <io.h> |
| 9 #endif | 9 #endif |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| 11 | 11 |
| 12 #include <fstream> | 12 #include <fstream> |
| 13 #include <limits> | 13 #include <limits> |
| 14 | 14 |
| 15 #include "base/files/file_enumerator.h" | 15 #include "base/files/file_enumerator.h" |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 | 23 |
| 24 #if defined(OS_FUCHSIA) |
| 25 #include <unistd.h> |
| 26 #endif |
| 27 |
| 24 namespace base { | 28 namespace base { |
| 25 | 29 |
| 26 #if !defined(OS_NACL_NONSFI) | 30 #if !defined(OS_NACL_NONSFI) |
| 27 namespace { | 31 namespace { |
| 28 | 32 |
| 29 // The maximum number of 'uniquified' files we will try to create. | 33 // The maximum number of 'uniquified' files we will try to create. |
| 30 // This is used when the filename we're trying to download is already in use, | 34 // This is used when the filename we're trying to download is already in use, |
| 31 // so we create a new unique filename by appending " (nnn)" before the | 35 // so we create a new unique filename by appending " (nnn)" before the |
| 32 // extension, where 1 <= nnn <= kMaxUniqueFiles. | 36 // extension, where 1 <= nnn <= kMaxUniqueFiles. |
| 33 // Also used by code that cleans up said files. | 37 // Also used by code that cleans up said files. |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) { | 258 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) { |
| 255 return count; | 259 return count; |
| 256 } | 260 } |
| 257 } | 261 } |
| 258 | 262 |
| 259 return -1; | 263 return -1; |
| 260 } | 264 } |
| 261 #endif // !defined(OS_NACL_NONSFI) | 265 #endif // !defined(OS_NACL_NONSFI) |
| 262 | 266 |
| 263 } // namespace base | 267 } // namespace base |
| OLD | NEW |