| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 BASE_EXPORT bool NormalizeToNativeFilePath(const FilePath& path, | 287 BASE_EXPORT bool NormalizeToNativeFilePath(const FilePath& path, |
| 288 FilePath* nt_path); | 288 FilePath* nt_path); |
| 289 #endif | 289 #endif |
| 290 | 290 |
| 291 // This function will return if the given file is a symlink or not. | 291 // This function will return if the given file is a symlink or not. |
| 292 BASE_EXPORT bool IsLink(const FilePath& file_path); | 292 BASE_EXPORT bool IsLink(const FilePath& file_path); |
| 293 | 293 |
| 294 // Returns information about the given file path. | 294 // Returns information about the given file path. |
| 295 BASE_EXPORT bool GetFileInfo(const FilePath& file_path, PlatformFileInfo* info); | 295 BASE_EXPORT bool GetFileInfo(const FilePath& file_path, PlatformFileInfo* info); |
| 296 | 296 |
| 297 // Sets the time of the last access and the time of the last modification. |
| 298 BASE_EXPORT bool TouchFile(const FilePath& path, |
| 299 const Time& last_accessed, |
| 300 const Time& last_modified); |
| 301 |
| 297 } // namespace base | 302 } // namespace base |
| 298 | 303 |
| 299 // ----------------------------------------------------------------------------- | 304 // ----------------------------------------------------------------------------- |
| 300 | 305 |
| 301 namespace file_util { | 306 namespace file_util { |
| 302 | 307 |
| 303 // Sets the time of the last access and the time of the last modification. | |
| 304 BASE_EXPORT bool TouchFile(const base::FilePath& path, | |
| 305 const base::Time& last_accessed, | |
| 306 const base::Time& last_modified); | |
| 307 | |
| 308 // Set the time of the last modification. Useful for unit tests. | |
| 309 BASE_EXPORT bool SetLastModifiedTime(const base::FilePath& path, | |
| 310 const base::Time& last_modified); | |
| 311 | |
| 312 #if defined(OS_POSIX) | 308 #if defined(OS_POSIX) |
| 313 // Store inode number of |path| in |inode|. Return true on success. | 309 // Store inode number of |path| in |inode|. Return true on success. |
| 314 BASE_EXPORT bool GetInode(const base::FilePath& path, ino_t* inode); | 310 BASE_EXPORT bool GetInode(const base::FilePath& path, ino_t* inode); |
| 315 #endif | 311 #endif |
| 316 | 312 |
| 317 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. | 313 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. |
| 318 BASE_EXPORT FILE* OpenFile(const base::FilePath& filename, const char* mode); | 314 BASE_EXPORT FILE* OpenFile(const base::FilePath& filename, const char* mode); |
| 319 | 315 |
| 320 // Closes file opened by OpenFile. Returns true on success. | 316 // Closes file opened by OpenFile. Returns true on success. |
| 321 BASE_EXPORT bool CloseFile(FILE* file); | 317 BASE_EXPORT bool CloseFile(FILE* file); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // This function simulates Move(), but unlike Move() it works across volumes. | 461 // This function simulates Move(), but unlike Move() it works across volumes. |
| 466 // This function is not transactional. | 462 // This function is not transactional. |
| 467 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 463 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
| 468 const FilePath& to_path); | 464 const FilePath& to_path); |
| 469 #endif // defined(OS_WIN) | 465 #endif // defined(OS_WIN) |
| 470 | 466 |
| 471 } // namespace internal | 467 } // namespace internal |
| 472 } // namespace base | 468 } // namespace base |
| 473 | 469 |
| 474 #endif // BASE_FILE_UTIL_H_ | 470 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |