Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1947)

Side by Side Diff: base/file_util.h

Issue 10263003: AppendToFile implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698