| 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 #pragma once | 10 #pragma once |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 #include <stack> | 25 #include <stack> |
| 26 #include <string> | 26 #include <string> |
| 27 #include <vector> | 27 #include <vector> |
| 28 | 28 |
| 29 #include "base/basictypes.h" | 29 #include "base/basictypes.h" |
| 30 #include "base/file_path.h" | 30 #include "base/file_path.h" |
| 31 #include "base/platform_file.h" | 31 #include "base/platform_file.h" |
| 32 #include "base/scoped_ptr.h" | 32 #include "base/scoped_ptr.h" |
| 33 #include "base/string16.h" | 33 #include "base/string16.h" |
| 34 #include "base/time.h" |
| 34 | 35 |
| 35 #if defined(OS_POSIX) | 36 #if defined(OS_POSIX) |
| 36 #include "base/eintr_wrapper.h" | 37 #include "base/eintr_wrapper.h" |
| 37 #include "base/file_descriptor_posix.h" | 38 #include "base/file_descriptor_posix.h" |
| 38 #include "base/logging.h" | 39 #include "base/logging.h" |
| 39 #endif | 40 #endif |
| 40 | 41 |
| 41 namespace base { | 42 namespace base { |
| 42 class Time; | 43 class Time; |
| 43 } | 44 } |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // Given an existing file in |path|, it returns in |real_path| the path | 311 // Given an existing file in |path|, it returns in |real_path| the path |
| 311 // in the native NT format, of the form "\Device\HarddiskVolumeXX\..". | 312 // in the native NT format, of the form "\Device\HarddiskVolumeXX\..". |
| 312 // Returns false it it fails. Empty files cannot be resolved with this | 313 // Returns false it it fails. Empty files cannot be resolved with this |
| 313 // function. | 314 // function. |
| 314 bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path); | 315 bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path); |
| 315 #endif | 316 #endif |
| 316 | 317 |
| 317 // Returns information about the given file path. | 318 // Returns information about the given file path. |
| 318 bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* info); | 319 bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* info); |
| 319 | 320 |
| 320 // Sets the time of the last access and the time of the last modification. | |
| 321 bool TouchFile(const FilePath& path, | |
| 322 const base::Time& last_accessed, | |
| 323 const base::Time& last_modified); | |
| 324 | |
| 325 // Set the time of the last modification. Useful for unit tests. | 321 // Set the time of the last modification. Useful for unit tests. |
| 326 bool SetLastModifiedTime(const FilePath& path, | 322 bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified); |
| 327 const base::Time& last_modified); | |
| 328 | 323 |
| 329 #if defined(OS_POSIX) | 324 #if defined(OS_POSIX) |
| 330 // Store inode number of |path| in |inode|. Return true on success. | 325 // Store inode number of |path| in |inode|. Return true on success. |
| 331 bool GetInode(const FilePath& path, ino_t* inode); | 326 bool GetInode(const FilePath& path, ino_t* inode); |
| 332 #endif | 327 #endif |
| 333 | 328 |
| 334 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. | 329 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. |
| 335 FILE* OpenFile(const FilePath& filename, const char* mode); | 330 FILE* OpenFile(const FilePath& filename, const char* mode); |
| 336 | 331 |
| 337 // Closes file opened by OpenFile. Returns true on success. | 332 // Closes file opened by OpenFile. Returns true on success. |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 bool GetFileSystemType(const FilePath& path, FileSystemType* type); | 621 bool GetFileSystemType(const FilePath& path, FileSystemType* type); |
| 627 #endif | 622 #endif |
| 628 | 623 |
| 629 } // namespace file_util | 624 } // namespace file_util |
| 630 | 625 |
| 631 // Deprecated functions have been moved to this separate header file, | 626 // Deprecated functions have been moved to this separate header file, |
| 632 // which must be included last after all the above definitions. | 627 // which must be included last after all the above definitions. |
| 633 #include "base/file_util_deprecated.h" | 628 #include "base/file_util_deprecated.h" |
| 634 | 629 |
| 635 #endif // BASE_FILE_UTIL_H_ | 630 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |