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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // directory's contents. Passing true to recursive deletes | 121 // directory's contents. Passing true to recursive deletes |
122 // subdirectories and their contents as well. | 122 // subdirectories and their contents as well. |
123 // Returns true if successful, false otherwise. | 123 // Returns true if successful, false otherwise. |
124 // | 124 // |
125 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT | 125 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT |
126 // TO "rm -rf", SO USE WITH CAUTION. | 126 // TO "rm -rf", SO USE WITH CAUTION. |
127 bool Delete(const FilePath& path, bool recursive); | 127 bool Delete(const FilePath& path, bool recursive); |
128 // Deprecated temporary compatibility function. | 128 // Deprecated temporary compatibility function. |
129 bool Delete(const std::wstring& path, bool recursive); | 129 bool Delete(const std::wstring& path, bool recursive); |
130 | 130 |
| 131 #if defined(OS_WIN) |
| 132 // Schedules to delete the given path, whether it's a file or a directory, until |
| 133 // the operating system is restarted. |
| 134 // Note: |
| 135 // 1) The file/directory to be deleted should exist in a temp folder. |
| 136 // 2) The directory to be deleted must be empty. |
| 137 bool DeleteAfterReboot(const FilePath& path); |
| 138 #endif |
| 139 |
131 // Moves the given path, whether it's a file or a directory. | 140 // Moves the given path, whether it's a file or a directory. |
132 // If a simple rename is not possible, such as in the case where the paths are | 141 // If a simple rename is not possible, such as in the case where the paths are |
133 // on different volumes, this will attempt to copy and delete. Returns | 142 // on different volumes, this will attempt to copy and delete. Returns |
134 // true for success. | 143 // true for success. |
135 bool Move(const FilePath& from_path, const FilePath& to_path); | 144 bool Move(const FilePath& from_path, const FilePath& to_path); |
136 | 145 |
137 // Renames file |from_path| to |to_path|. Both paths must be on the same | 146 // Renames file |from_path| to |to_path|. Both paths must be on the same |
138 // volume, or the function will fail. Destination file will be created | 147 // volume, or the function will fail. Destination file will be created |
139 // if it doesn't exist. Prefer this function over Move when dealing with | 148 // if it doesn't exist. Prefer this function over Move when dealing with |
140 // temporary files. On Windows it preserves attributes of the target file. | 149 // temporary files. On Windows it preserves attributes of the target file. |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 const FilePath& source_file_path, | 552 const FilePath& source_file_path, |
544 const FilePath& target_file_path); | 553 const FilePath& target_file_path); |
545 | 554 |
546 // Returns whether the file has been modified since a particular date. | 555 // Returns whether the file has been modified since a particular date. |
547 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, | 556 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, |
548 const base::Time& cutoff_time); | 557 const base::Time& cutoff_time); |
549 | 558 |
550 } // namespace file_util | 559 } // namespace file_util |
551 | 560 |
552 #endif // BASE_FILE_UTIL_H_ | 561 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |