OLD | NEW |
1 // Copyright (c) 2006-2008 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 |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 base::Time last_modified; | 325 base::Time last_modified; |
326 | 326 |
327 // Add additional fields here as needed. | 327 // Add additional fields here as needed. |
328 }; | 328 }; |
329 | 329 |
330 // Returns information about the given file path. | 330 // Returns information about the given file path. |
331 bool GetFileInfo(const FilePath& file_path, FileInfo* info); | 331 bool GetFileInfo(const FilePath& file_path, FileInfo* info); |
332 // Deprecated temporary compatibility function. | 332 // Deprecated temporary compatibility function. |
333 bool GetFileInfo(const std::wstring& file_path, FileInfo* info); | 333 bool GetFileInfo(const std::wstring& file_path, FileInfo* info); |
334 | 334 |
| 335 // Set the time of the last modification. Useful for unit tests. |
| 336 bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified); |
| 337 |
335 #if defined(OS_POSIX) | 338 #if defined(OS_POSIX) |
336 // Store inode number of |path| in |inode|. Return true on success. | 339 // Store inode number of |path| in |inode|. Return true on success. |
337 bool GetInode(const FilePath& path, ino_t* inode); | 340 bool GetInode(const FilePath& path, ino_t* inode); |
338 #endif | 341 #endif |
339 | 342 |
340 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. | 343 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. |
341 FILE* OpenFile(const FilePath& filename, const char* mode); | 344 FILE* OpenFile(const FilePath& filename, const char* mode); |
342 // Deprecated temporary compatibility functions. | 345 // Deprecated temporary compatibility functions. |
343 FILE* OpenFile(const std::string& filename, const char* mode); | 346 FILE* OpenFile(const std::string& filename, const char* mode); |
344 FILE* OpenFile(const std::wstring& filename, const char* mode); | 347 FILE* OpenFile(const std::wstring& filename, const char* mode); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 const FilePath& source_file_path, | 558 const FilePath& source_file_path, |
556 const FilePath& target_file_path); | 559 const FilePath& target_file_path); |
557 | 560 |
558 // Returns whether the file has been modified since a particular date. | 561 // Returns whether the file has been modified since a particular date. |
559 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, | 562 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, |
560 const base::Time& cutoff_time); | 563 const base::Time& cutoff_time); |
561 | 564 |
562 } // namespace file_util | 565 } // namespace file_util |
563 | 566 |
564 #endif // BASE_FILE_UTIL_H_ | 567 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |