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 // This file contains utility functions for dealing with the local | 5 // This file contains utility functions for dealing with the local |
6 // filesystem. | 6 // filesystem. |
7 | 7 |
8 #ifndef BASE_FILE_UTIL_H_ | 8 #ifndef BASE_FILE_UTIL_H_ |
9 #define BASE_FILE_UTIL_H_ | 9 #define BASE_FILE_UTIL_H_ |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // temporary files. On Windows it preserves attributes of the target file. | 91 // temporary files. On Windows it preserves attributes of the target file. |
92 // Returns true on success, leaving *error unchanged. | 92 // Returns true on success, leaving *error unchanged. |
93 // Returns false on failure and sets *error appropriately, if it is non-NULL. | 93 // Returns false on failure and sets *error appropriately, if it is non-NULL. |
94 BASE_EXPORT bool ReplaceFile(const FilePath& from_path, | 94 BASE_EXPORT bool ReplaceFile(const FilePath& from_path, |
95 const FilePath& to_path, | 95 const FilePath& to_path, |
96 File::Error* error); | 96 File::Error* error); |
97 | 97 |
98 // Copies a single file. Use CopyDirectory to copy directories. | 98 // Copies a single file. Use CopyDirectory to copy directories. |
99 // This function fails if either path contains traversal components ('..'). | 99 // This function fails if either path contains traversal components ('..'). |
100 // | 100 // |
101 // This function keeps the metadata on OSX and on Windows. The read only bit on | 101 // This function keeps the metadata on Windows. The read only bit on Windows is |
102 // Windows is not kept. | 102 // not kept. |
103 BASE_EXPORT bool CopyFile(const FilePath& from_path, const FilePath& to_path); | 103 BASE_EXPORT bool CopyFile(const FilePath& from_path, const FilePath& to_path); |
104 | 104 |
105 // Copies the given path, and optionally all subdirectories and their contents | 105 // Copies the given path, and optionally all subdirectories and their contents |
106 // as well. | 106 // as well. |
107 // | 107 // |
108 // If there are files existing under to_path, always overwrite. Returns true | 108 // If there are files existing under to_path, always overwrite. Returns true |
109 // if successful, false otherwise. Wildcards on the names are not supported. | 109 // if successful, false otherwise. Wildcards on the names are not supported. |
110 // | 110 // |
111 // This function calls into CopyFile() so the same behavior w.r.t. metadata | 111 // This function calls into CopyFile() so the same behavior w.r.t. metadata |
112 // applies. | 112 // applies. |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 // This function simulates Move(), but unlike Move() it works across volumes. | 462 // This function simulates Move(), but unlike Move() it works across volumes. |
463 // This function is not transactional. | 463 // This function is not transactional. |
464 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 464 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
465 const FilePath& to_path); | 465 const FilePath& to_path); |
466 #endif // defined(OS_WIN) | 466 #endif // defined(OS_WIN) |
467 | 467 |
468 } // namespace internal | 468 } // namespace internal |
469 } // namespace base | 469 } // namespace base |
470 | 470 |
471 #endif // BASE_FILE_UTIL_H_ | 471 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |