| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 BASE_EXPORT bool TouchFile(const FilePath& path, | 301 BASE_EXPORT bool TouchFile(const FilePath& path, |
| 302 const Time& last_accessed, | 302 const Time& last_accessed, |
| 303 const Time& last_modified); | 303 const Time& last_modified); |
| 304 | 304 |
| 305 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. | 305 // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. |
| 306 BASE_EXPORT FILE* OpenFile(const FilePath& filename, const char* mode); | 306 BASE_EXPORT FILE* OpenFile(const FilePath& filename, const char* mode); |
| 307 | 307 |
| 308 // Closes file opened by OpenFile. Returns true on success. | 308 // Closes file opened by OpenFile. Returns true on success. |
| 309 BASE_EXPORT bool CloseFile(FILE* file); | 309 BASE_EXPORT bool CloseFile(FILE* file); |
| 310 | 310 |
| 311 // Associates a standard FILE stream with an existing File. Note that this |
| 312 // functions take ownership of the existing File. |
| 313 BASE_EXPORT FILE* FileToFILE(File file, const char* mode); |
| 314 |
| 311 // Truncates an open file to end at the location of the current file pointer. | 315 // Truncates an open file to end at the location of the current file pointer. |
| 312 // This is a cross-platform analog to Windows' SetEndOfFile() function. | 316 // This is a cross-platform analog to Windows' SetEndOfFile() function. |
| 313 BASE_EXPORT bool TruncateFile(FILE* file); | 317 BASE_EXPORT bool TruncateFile(FILE* file); |
| 314 | 318 |
| 315 // Reads at most the given number of bytes from the file into the buffer. | 319 // Reads at most the given number of bytes from the file into the buffer. |
| 316 // Returns the number of read bytes, or -1 on error. | 320 // Returns the number of read bytes, or -1 on error. |
| 317 BASE_EXPORT int ReadFile(const FilePath& filename, char* data, int max_size); | 321 BASE_EXPORT int ReadFile(const FilePath& filename, char* data, int max_size); |
| 318 | 322 |
| 319 // Writes the given buffer into the file, overwriting any data that was | 323 // Writes the given buffer into the file, overwriting any data that was |
| 320 // previously there. Returns the number of bytes written, or -1 on error. | 324 // previously there. Returns the number of bytes written, or -1 on error. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 // This function simulates Move(), but unlike Move() it works across volumes. | 450 // This function simulates Move(), but unlike Move() it works across volumes. |
| 447 // This function is not transactional. | 451 // This function is not transactional. |
| 448 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 452 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
| 449 const FilePath& to_path); | 453 const FilePath& to_path); |
| 450 #endif // defined(OS_WIN) | 454 #endif // defined(OS_WIN) |
| 451 | 455 |
| 452 } // namespace internal | 456 } // namespace internal |
| 453 } // namespace base | 457 } // namespace base |
| 454 | 458 |
| 455 #endif // BASE_FILE_UTIL_H_ | 459 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |