| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // directory's contents. Passing true to recursive deletes | 62 // directory's contents. Passing true to recursive deletes |
| 63 // subdirectories and their contents as well. | 63 // subdirectories and their contents as well. |
| 64 // Returns true if successful, false otherwise. It is considered successful | 64 // Returns true if successful, false otherwise. It is considered successful |
| 65 // to attempt to delete a file that does not exist. | 65 // to attempt to delete a file that does not exist. |
| 66 // | 66 // |
| 67 // In posix environment and if |path| is a symbolic link, this deletes only | 67 // In posix environment and if |path| is a symbolic link, this deletes only |
| 68 // the symlink. (even if the symlink points to a non-existent file) | 68 // the symlink. (even if the symlink points to a non-existent file) |
| 69 // | 69 // |
| 70 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT | 70 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT |
| 71 // TO "rm -rf", SO USE WITH CAUTION. | 71 // TO "rm -rf", SO USE WITH CAUTION. |
| 72 BASE_EXPORT bool Delete(const FilePath& path, bool recursive); | 72 BASE_EXPORT bool DeleteFile(const FilePath& path, bool recursive); |
| 73 | 73 |
| 74 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
| 75 // Schedules to delete the given path, whether it's a file or a directory, until | 75 // Schedules to delete the given path, whether it's a file or a directory, until |
| 76 // the operating system is restarted. | 76 // the operating system is restarted. |
| 77 // Note: | 77 // Note: |
| 78 // 1) The file/directory to be deleted should exist in a temp folder. | 78 // 1) The file/directory to be deleted should exist in a temp folder. |
| 79 // 2) The directory to be deleted must be empty. | 79 // 2) The directory to be deleted must be empty. |
| 80 BASE_EXPORT bool DeleteAfterReboot(const FilePath& path); | 80 BASE_EXPORT bool DeleteFileAfterReboot(const FilePath& path); |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 // Moves the given path, whether it's a file or a directory. | 83 // Moves the given path, whether it's a file or a directory. |
| 84 // If a simple rename is not possible, such as in the case where the paths are | 84 // If a simple rename is not possible, such as in the case where the paths are |
| 85 // on different volumes, this will attempt to copy and delete. Returns | 85 // on different volumes, this will attempt to copy and delete. Returns |
| 86 // true for success. | 86 // true for success. |
| 87 // This function fails if either path contains traversal components ('..'). | 87 // This function fails if either path contains traversal components ('..'). |
| 88 BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path); | 88 BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path); |
| 89 | 89 |
| 90 // Renames file |from_path| to |to_path|. Both paths must be on the same | 90 // Renames file |from_path| to |to_path|. Both paths must be on the same |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 // This function simulates Move(), but unlike Move() it works across volumes. | 455 // This function simulates Move(), but unlike Move() it works across volumes. |
| 456 // This fuction is not transactional. | 456 // This fuction is not transactional. |
| 457 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 457 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
| 458 const FilePath& to_path); | 458 const FilePath& to_path); |
| 459 #endif // defined(OS_WIN) | 459 #endif // defined(OS_WIN) |
| 460 | 460 |
| 461 } // namespace internal | 461 } // namespace internal |
| 462 } // namespace base | 462 } // namespace base |
| 463 | 463 |
| 464 #endif // BASE_FILE_UTIL_H_ | 464 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |