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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 bool NormalizeFilePath(const FilePath& path, FilePath* real_path); | 308 bool NormalizeFilePath(const FilePath& path, FilePath* real_path); |
309 | 309 |
310 #if defined(OS_WIN) | 310 #if defined(OS_WIN) |
311 // 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 |
312 // in the native NT format, of the form "\Device\HarddiskVolumeXX\..". | 312 // in the native NT format, of the form "\Device\HarddiskVolumeXX\..". |
313 // 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 |
314 // function. | 314 // function. |
315 bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path); | 315 bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path); |
316 #endif | 316 #endif |
317 | 317 |
318 // Used to hold information about a given file path. See GetFileInfo below. | |
319 struct FileInfo { | |
320 // The size of the file in bytes. Undefined when is_directory is true. | |
321 int64 size; | |
322 | |
323 // True if the file corresponds to a directory. | |
324 bool is_directory; | |
325 | |
326 // The last modified time of a file. | |
327 base::Time last_modified; | |
328 | |
329 // Add additional fields here as needed. | |
330 }; | |
331 | |
332 // Returns information about the given file path. | 318 // Returns information about the given file path. |
333 bool GetFileInfo(const FilePath& file_path, FileInfo* info); | 319 bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* info); |
334 | 320 |
335 // Set the time of the last modification. Useful for unit tests. | 321 // Set the time of the last modification. Useful for unit tests. |
336 bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified); | 322 bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified); |
337 | 323 |
338 #if defined(OS_POSIX) | 324 #if defined(OS_POSIX) |
339 // Store inode number of |path| in |inode|. Return true on success. | 325 // Store inode number of |path| in |inode|. Return true on success. |
340 bool GetInode(const FilePath& path, ino_t* inode); | 326 bool GetInode(const FilePath& path, ino_t* inode); |
341 #endif | 327 #endif |
342 | 328 |
343 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. | 329 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 bool GetFileSystemType(const FilePath& path, FileSystemType* type); | 621 bool GetFileSystemType(const FilePath& path, FileSystemType* type); |
636 #endif | 622 #endif |
637 | 623 |
638 } // namespace file_util | 624 } // namespace file_util |
639 | 625 |
640 // Deprecated functions have been moved to this separate header file, | 626 // Deprecated functions have been moved to this separate header file, |
641 // which must be included last after all the above definitions. | 627 // which must be included last after all the above definitions. |
642 #include "base/file_util_deprecated.h" | 628 #include "base/file_util_deprecated.h" |
643 | 629 |
644 #endif // BASE_FILE_UTIL_H_ | 630 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |