| 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 #pragma once | 10 #pragma once |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // the number of read bytes, or -1 on error. | 371 // the number of read bytes, or -1 on error. |
| 372 BASE_EXPORT int ReadFile(const FilePath& filename, char* data, int size); | 372 BASE_EXPORT int ReadFile(const FilePath& filename, char* data, int size); |
| 373 | 373 |
| 374 // Writes the given buffer into the file, overwriting any data that was | 374 // Writes the given buffer into the file, overwriting any data that was |
| 375 // previously there. Returns the number of bytes written, or -1 on error. | 375 // previously there. Returns the number of bytes written, or -1 on error. |
| 376 BASE_EXPORT int WriteFile(const FilePath& filename, const char* data, int size); | 376 BASE_EXPORT int WriteFile(const FilePath& filename, const char* data, int size); |
| 377 #if defined(OS_POSIX) | 377 #if defined(OS_POSIX) |
| 378 // Append the data to |fd|. Does not close |fd| when done. | 378 // Append the data to |fd|. Does not close |fd| when done. |
| 379 BASE_EXPORT int WriteFileDescriptor(const int fd, const char* data, int size); | 379 BASE_EXPORT int WriteFileDescriptor(const int fd, const char* data, int size); |
| 380 #endif | 380 #endif |
| 381 // Append the given buffer into the file. Returns the number of bytes written, |
| 382 // or -1 on error. |
| 383 BASE_EXPORT int AppendToFile(const FilePath& filename, |
| 384 const char* data, int size); |
| 381 | 385 |
| 382 // Gets the current working directory for the process. | 386 // Gets the current working directory for the process. |
| 383 BASE_EXPORT bool GetCurrentDirectory(FilePath* path); | 387 BASE_EXPORT bool GetCurrentDirectory(FilePath* path); |
| 384 | 388 |
| 385 // Sets the current working directory for the process. | 389 // Sets the current working directory for the process. |
| 386 BASE_EXPORT bool SetCurrentDirectory(const FilePath& path); | 390 BASE_EXPORT bool SetCurrentDirectory(const FilePath& path); |
| 387 | 391 |
| 388 // Attempts to find a number that can be appended to the |path| to make it | 392 // Attempts to find a number that can be appended to the |path| to make it |
| 389 // unique. If |path| does not exist, 0 is returned. If it fails to find such | 393 // unique. If |path| does not exist, 0 is returned. If it fails to find such |
| 390 // a number, -1 is returned. If |suffix| is not empty, also checks the | 394 // a number, -1 is returned. If |suffix| is not empty, also checks the |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 }; | 633 }; |
| 630 | 634 |
| 631 // Attempts determine the FileSystemType for |path|. | 635 // Attempts determine the FileSystemType for |path|. |
| 632 // Returns false if |path| doesn't exist. | 636 // Returns false if |path| doesn't exist. |
| 633 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); | 637 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); |
| 634 #endif | 638 #endif |
| 635 | 639 |
| 636 } // namespace file_util | 640 } // namespace file_util |
| 637 | 641 |
| 638 #endif // BASE_FILE_UTIL_H_ | 642 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |