| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // created on or after the given |file_time|. Doesn't count ".." or ".". | 64 // created on or after the given |file_time|. Doesn't count ".." or ".". |
| 65 // | 65 // |
| 66 // Note for POSIX environments: a file created before |file_time| | 66 // Note for POSIX environments: a file created before |file_time| |
| 67 // can be mis-detected as a newer file due to low precision of | 67 // can be mis-detected as a newer file due to low precision of |
| 68 // timestmap of file creation time. If you need to avoid such | 68 // timestmap of file creation time. If you need to avoid such |
| 69 // mis-detection perfectly, you should wait one second before | 69 // mis-detection perfectly, you should wait one second before |
| 70 // obtaining |file_time|. | 70 // obtaining |file_time|. |
| 71 int CountFilesCreatedAfter(const FilePath& path, | 71 int CountFilesCreatedAfter(const FilePath& path, |
| 72 const base::Time& file_time); | 72 const base::Time& file_time); |
| 73 | 73 |
| 74 // Returns the total number of bytes used by all the files under |root_path|. |
| 75 // If the path does not exist the function returns 0. |
| 76 // |
| 77 // This function is implemented using the FileEnumerator class so it is not |
| 78 // particularly speedy in any platform. |
| 79 int64 ComputeDirectorySize(const FilePath& root_path); |
| 80 |
| 74 // Deletes the given path, whether it's a file or a directory. | 81 // Deletes the given path, whether it's a file or a directory. |
| 75 // If it's a directory, it's perfectly happy to delete all of the | 82 // If it's a directory, it's perfectly happy to delete all of the |
| 76 // directory's contents. Passing true to recursive deletes | 83 // directory's contents. Passing true to recursive deletes |
| 77 // subdirectories and their contents as well. | 84 // subdirectories and their contents as well. |
| 78 // Returns true if successful, false otherwise. | 85 // Returns true if successful, false otherwise. |
| 79 // | 86 // |
| 80 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT | 87 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT |
| 81 // TO "rm -rf", SO USE WITH CAUTION. | 88 // TO "rm -rf", SO USE WITH CAUTION. |
| 82 bool Delete(const FilePath& path, bool recursive); | 89 bool Delete(const FilePath& path, bool recursive); |
| 83 | 90 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, | 502 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, |
| 496 const base::Time& cutoff_time); | 503 const base::Time& cutoff_time); |
| 497 | 504 |
| 498 } // namespace file_util | 505 } // namespace file_util |
| 499 | 506 |
| 500 // Deprecated functions have been moved to this separate header file, | 507 // Deprecated functions have been moved to this separate header file, |
| 501 // which must be included last after all the above definitions. | 508 // which must be included last after all the above definitions. |
| 502 #include "base/file_util_deprecated.h" | 509 #include "base/file_util_deprecated.h" |
| 503 | 510 |
| 504 #endif // BASE_FILE_UTIL_H_ | 511 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |