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