| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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" |
| 12 | 12 |
| 13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
| 14 #include <windows.h> | 14 #include <windows.h> |
| 15 #elif defined(OS_POSIX) | 15 #elif defined(OS_POSIX) |
| 16 #include <fts.h> | 16 #include <fts.h> |
| 17 #include <sys/stat.h> | 17 #include <sys/stat.h> |
| 18 #include <sys/types.h> |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 #include <stdio.h> | 21 #include <stdio.h> |
| 21 | 22 |
| 22 #include <stack> | 23 #include <stack> |
| 23 #include <string> | 24 #include <string> |
| 24 #include <vector> | 25 #include <vector> |
| 25 | 26 |
| 26 #include "base/basictypes.h" | 27 #include "base/basictypes.h" |
| 27 #include "base/scoped_ptr.h" | 28 #include "base/scoped_ptr.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 bool is_directory; | 336 bool is_directory; |
| 336 | 337 |
| 337 // Add additional fields here as needed. | 338 // Add additional fields here as needed. |
| 338 }; | 339 }; |
| 339 | 340 |
| 340 // Returns information about the given file path. | 341 // Returns information about the given file path. |
| 341 bool GetFileInfo(const FilePath& file_path, FileInfo* info); | 342 bool GetFileInfo(const FilePath& file_path, FileInfo* info); |
| 342 // Deprecated temporary compatibility function. | 343 // Deprecated temporary compatibility function. |
| 343 bool GetFileInfo(const std::wstring& file_path, FileInfo* info); | 344 bool GetFileInfo(const std::wstring& file_path, FileInfo* info); |
| 344 | 345 |
| 346 #if defined(OS_POSIX) |
| 347 // Store inode number of |path| in |inode|. Return true on success. |
| 348 bool GetInode(const FilePath& path, ino_t* inode); |
| 349 #endif |
| 350 |
| 345 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. | 351 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. |
| 346 FILE* OpenFile(const FilePath& filename, const char* mode); | 352 FILE* OpenFile(const FilePath& filename, const char* mode); |
| 347 // Deprecated temporary compatibility functions. | 353 // Deprecated temporary compatibility functions. |
| 348 FILE* OpenFile(const std::string& filename, const char* mode); | 354 FILE* OpenFile(const std::string& filename, const char* mode); |
| 349 FILE* OpenFile(const std::wstring& filename, const char* mode); | 355 FILE* OpenFile(const std::wstring& filename, const char* mode); |
| 350 | 356 |
| 351 // Closes file opened by OpenFile. Returns true on success. | 357 // Closes file opened by OpenFile. Returns true on success. |
| 352 bool CloseFile(FILE* file); | 358 bool CloseFile(FILE* file); |
| 353 | 359 |
| 354 // Truncates an open file to end at the location of the current file pointer. | 360 // Truncates an open file to end at the location of the current file pointer. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 | 519 |
| 514 // Renames a file using the SHFileOperation API to ensure that the target file | 520 // Renames a file using the SHFileOperation API to ensure that the target file |
| 515 // gets the correct default security descriptor in the new path. | 521 // gets the correct default security descriptor in the new path. |
| 516 bool RenameFileAndResetSecurityDescriptor( | 522 bool RenameFileAndResetSecurityDescriptor( |
| 517 const FilePath& source_file_path, | 523 const FilePath& source_file_path, |
| 518 const FilePath& target_file_path); | 524 const FilePath& target_file_path); |
| 519 | 525 |
| 520 } // namespace file_util | 526 } // namespace file_util |
| 521 | 527 |
| 522 #endif // BASE_FILE_UTIL_H_ | 528 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |