OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // subdirectories and their contents as well. | 147 // subdirectories and their contents as well. |
148 // Returns true if successful, false otherwise. | 148 // Returns true if successful, false otherwise. |
149 // | 149 // |
150 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT | 150 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT |
151 // TO "rm -rf", SO USE WITH CAUTION. | 151 // TO "rm -rf", SO USE WITH CAUTION. |
152 bool Delete(const FilePath& path, bool recursive); | 152 bool Delete(const FilePath& path, bool recursive); |
153 // Deprecated temporary compatibility function. | 153 // Deprecated temporary compatibility function. |
154 bool Delete(const std::wstring& path, bool recursive); | 154 bool Delete(const std::wstring& path, bool recursive); |
155 | 155 |
156 // Moves the given path, whether it's a file or a directory. | 156 // Moves the given path, whether it's a file or a directory. |
157 // Returns true if successful, false otherwise. | 157 // If a simple rename is not possible, such as in the case where the paths are |
| 158 // on different volumes, this will attempt to copy and delete. Returns |
| 159 // true for success. |
158 bool Move(const FilePath& from_path, const FilePath& to_path); | 160 bool Move(const FilePath& from_path, const FilePath& to_path); |
159 // Deprecated temporary compatibility function. | 161 // Deprecated temporary compatibility function. |
160 bool Move(const std::wstring& from_path, const std::wstring& to_path); | 162 bool Move(const std::wstring& from_path, const std::wstring& to_path); |
161 | 163 |
162 // Copies a single file. Use CopyDirectory to copy directories. | 164 // Copies a single file. Use CopyDirectory to copy directories. |
163 bool CopyFile(const FilePath& from_path, const FilePath& to_path); | 165 bool CopyFile(const FilePath& from_path, const FilePath& to_path); |
164 // Deprecated temporary compatibility function. | 166 // Deprecated temporary compatibility function. |
165 bool CopyFile(const std::wstring& from_path, const std::wstring& to_path); | 167 bool CopyFile(const std::wstring& from_path, const std::wstring& to_path); |
166 | 168 |
167 // Copies the given path, and optionally all subdirectories and their contents | 169 // Copies the given path, and optionally all subdirectories and their contents |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 503 |
502 // Renames a file using the SHFileOperation API to ensure that the target file | 504 // Renames a file using the SHFileOperation API to ensure that the target file |
503 // gets the correct default security descriptor in the new path. | 505 // gets the correct default security descriptor in the new path. |
504 bool RenameFileAndResetSecurityDescriptor( | 506 bool RenameFileAndResetSecurityDescriptor( |
505 const FilePath& source_file_path, | 507 const FilePath& source_file_path, |
506 const FilePath& target_file_path); | 508 const FilePath& target_file_path); |
507 | 509 |
508 } // namespace file_util | 510 } // namespace file_util |
509 | 511 |
510 #endif // BASE_FILE_UTIL_H_ | 512 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |