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

Side by Side Diff: base/files/file_util.h

Issue 693493004: Revert of Allow POSIX callers to specify a new file's mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | base/files/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_FILES_FILE_UTIL_H_ 8 #ifndef BASE_FILES_FILE_UTIL_H_
9 #define BASE_FILES_FILE_UTIL_H_ 9 #define BASE_FILES_FILE_UTIL_H_
10 10
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // 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.
316 // This is a cross-platform analog to Windows' SetEndOfFile() function. 316 // This is a cross-platform analog to Windows' SetEndOfFile() function.
317 BASE_EXPORT bool TruncateFile(FILE* file); 317 BASE_EXPORT bool TruncateFile(FILE* file);
318 318
319 // 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.
320 // Returns the number of read bytes, or -1 on error. 320 // Returns the number of read bytes, or -1 on error.
321 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);
322 322
323 // 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
324 // 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.
325 // The file will be created with a default mode (POSIX) or security
326 // descriptor (Windows). To specify a mode on POSIX, use |WriteFileWithMode|.
327 BASE_EXPORT int WriteFile(const FilePath& filename, const char* data, 325 BASE_EXPORT int WriteFile(const FilePath& filename, const char* data,
328 int size); 326 int size);
329 327
330 #if defined(OS_POSIX) 328 #if defined(OS_POSIX)
331 // Appends |data| to |fd|. Does not close |fd| when done. Returns true iff 329 // Appends |data| to |fd|. Does not close |fd| when done. Returns true iff
332 // |size| bytes of |data| were written to |fd|. 330 // |size| bytes of |data| were written to |fd|.
333 BASE_EXPORT bool WriteFileDescriptor(const int fd, const char* data, int size); 331 BASE_EXPORT bool WriteFileDescriptor(const int fd, const char* data, int size);
334
335 // Writes the given buffer into the file, overwriting any data that was
336 // previously there. Returns true iff |size| bytes of |data| were written to
337 // |filename|. The file is created with the given |mode|.
338 BASE_EXPORT bool WriteFileWithMode(const FilePath& filename, const char* data,
339 int size, mode_t mode);
340 #endif 332 #endif
341 333
342 // Appends |data| to |filename|. Returns true iff |size| bytes of |data| were 334 // Appends |data| to |filename|. Returns true iff |size| bytes of |data| were
343 // written to |filename|. 335 // written to |filename|.
344 BASE_EXPORT bool AppendToFile(const FilePath& filename, 336 BASE_EXPORT bool AppendToFile(const FilePath& filename,
345 const char* data, 337 const char* data,
346 int size); 338 int size);
347 339
348 // Gets the current working directory for the process. 340 // Gets the current working directory for the process.
349 BASE_EXPORT bool GetCurrentDirectory(FilePath* path); 341 BASE_EXPORT bool GetCurrentDirectory(FilePath* path);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // This function simulates Move(), but unlike Move() it works across volumes. 432 // This function simulates Move(), but unlike Move() it works across volumes.
441 // This function is not transactional. 433 // This function is not transactional.
442 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, 434 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path,
443 const FilePath& to_path); 435 const FilePath& to_path);
444 #endif // defined(OS_WIN) 436 #endif // defined(OS_WIN)
445 437
446 } // namespace internal 438 } // namespace internal
447 } // namespace base 439 } // namespace base
448 440
449 #endif // BASE_FILES_FILE_UTIL_H_ 441 #endif // BASE_FILES_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/files/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698