| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // | 125 // |
| 126 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT | 126 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT |
| 127 // TO "rm -rf", SO USE WITH CAUTION. | 127 // TO "rm -rf", SO USE WITH CAUTION. |
| 128 bool Delete(const std::wstring& path, bool recursive); | 128 bool Delete(const std::wstring& path, bool recursive); |
| 129 | 129 |
| 130 // Moves the given path, whether it's a file or a directory. | 130 // Moves the given path, whether it's a file or a directory. |
| 131 // Returns true if successful, false otherwise. | 131 // Returns true if successful, false otherwise. |
| 132 bool Move(const std::wstring& from_path, const std::wstring& to_path); | 132 bool Move(const std::wstring& from_path, const std::wstring& to_path); |
| 133 | 133 |
| 134 // Copies a single file. Use CopyDirectory to copy directories. | 134 // Copies a single file. Use CopyDirectory to copy directories. |
| 135 // |
| 136 // Behavior regarding attributes, permissions, metadata, etc is not guaranteed, |
| 137 // which means it may differ across platforms. |
| 135 bool CopyFile(const std::wstring& from_path, const std::wstring& to_path); | 138 bool CopyFile(const std::wstring& from_path, const std::wstring& to_path); |
| 136 | 139 |
| 137 // Copies the given path, and optionally all subdirectories and their contents | 140 // Copies the given path, and optionally all subdirectories and their contents |
| 138 // as well. | 141 // as well. |
| 139 // If there are files existing under to_path, always overwrite. | 142 // If there are files existing under to_path, always overwrite. |
| 140 // Returns true if successful, false otherwise. | 143 // Returns true if successful, false otherwise. |
| 141 // Dont't use wildcards on the names, it may stop working without notice. | 144 // Dont't use wildcards on the names, it may stop working without notice. |
| 142 // | 145 // |
| 143 // If you only need to copy a file use CopyFile, it's faster. | 146 // If you only need to copy a file use CopyFile, it's faster. |
| 147 // |
| 148 // Behavior regarding attributes, permissions, metadata, etc is not guaranteed, |
| 149 // which means it may differ across platforms. |
| 144 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, | 150 bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, |
| 145 bool recursive); | 151 bool recursive); |
| 146 | 152 |
| 147 // Returns true if the given path exists on the local filesystem, | 153 // Returns true if the given path exists on the local filesystem, |
| 148 // false otherwise. | 154 // false otherwise. |
| 149 bool PathExists(const std::wstring& path); | 155 bool PathExists(const std::wstring& path); |
| 150 | 156 |
| 151 // Returns true if the given path is writable by the user, false otherwise. | 157 // Returns true if the given path is writable by the user, false otherwise. |
| 152 bool PathIsWritable(const std::wstring& path); | 158 bool PathIsWritable(const std::wstring& path); |
| 153 | 159 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 323 |
| 318 // Renames a file using the MoveFileEx API and ensures that the target file gets | 324 // Renames a file using the MoveFileEx API and ensures that the target file gets |
| 319 // the correct security descriptor in the new path. | 325 // the correct security descriptor in the new path. |
| 320 bool RenameFileAndResetSecurityDescriptor( | 326 bool RenameFileAndResetSecurityDescriptor( |
| 321 const std::wstring& source_file_path, | 327 const std::wstring& source_file_path, |
| 322 const std::wstring& target_file_path); | 328 const std::wstring& target_file_path); |
| 323 | 329 |
| 324 } // namespace file_util | 330 } // namespace file_util |
| 325 | 331 |
| 326 #endif // BASE_FILE_UTIL_H_ | 332 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |