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

Side by Side Diff: base/file_util.h

Issue 14886003: Make base:ReplaceFile return an informative error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change comment Created 7 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') | base/file_util_posix.cc » ('J')
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 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 // Same as Move but allows paths with traversal components. 95 // Same as Move but allows paths with traversal components.
96 // Use only with extreme care. 96 // Use only with extreme care.
97 BASE_EXPORT bool MoveUnsafe(const base::FilePath& from_path, 97 BASE_EXPORT bool MoveUnsafe(const base::FilePath& from_path,
98 const base::FilePath& to_path); 98 const base::FilePath& to_path);
99 99
100 // Renames file |from_path| to |to_path|. Both paths must be on the same 100 // Renames file |from_path| to |to_path|. Both paths must be on the same
101 // volume, or the function will fail. Destination file will be created 101 // volume, or the function will fail. Destination file will be created
102 // if it doesn't exist. Prefer this function over Move when dealing with 102 // if it doesn't exist. Prefer this function over Move when dealing with
103 // temporary files. On Windows it preserves attributes of the target file. 103 // temporary files. On Windows it preserves attributes of the target file.
104 // Returns true on success. 104 // Returns true on success and optionally sets *error to base::PLATFORM_FILE_OK.
jar (doing other things) 2013/05/07 01:12:36 nit: I think you should avoid specing things as "o
dgrogan 2013/05/07 19:02:05 That sounds fine. But it will require changing all
jar (doing other things) 2013/05/07 19:44:50 Default args would indeed be less disruptive... bu
105 // Returns false on failure and optionally sets *error appropriately.
105 BASE_EXPORT bool ReplaceFile(const base::FilePath& from_path, 106 BASE_EXPORT bool ReplaceFile(const base::FilePath& from_path,
106 const base::FilePath& to_path); 107 const base::FilePath& to_path,
108 base::PlatformFileError* error = NULL);
jar (doing other things) 2013/05/07 01:12:36 nit: default arguments are not allowed according t
107 109
108 // Copies a single file. Use CopyDirectory to copy directories. 110 // Copies a single file. Use CopyDirectory to copy directories.
109 // This function fails if either path contains traversal components ('..'). 111 // This function fails if either path contains traversal components ('..').
110 BASE_EXPORT bool CopyFile(const base::FilePath& from_path, 112 BASE_EXPORT bool CopyFile(const base::FilePath& from_path,
111 const base::FilePath& to_path); 113 const base::FilePath& to_path);
112 114
113 // Same as CopyFile but allows paths with traversal components. 115 // Same as CopyFile but allows paths with traversal components.
114 // Use only with extreme care. 116 // Use only with extreme care.
115 BASE_EXPORT bool CopyFileUnsafe(const base::FilePath& from_path, 117 BASE_EXPORT bool CopyFileUnsafe(const base::FilePath& from_path,
116 const base::FilePath& to_path); 118 const base::FilePath& to_path);
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 548
547 // Attempts determine the FileSystemType for |path|. 549 // Attempts determine the FileSystemType for |path|.
548 // Returns false if |path| doesn't exist. 550 // Returns false if |path| doesn't exist.
549 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path, 551 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path,
550 FileSystemType* type); 552 FileSystemType* type);
551 #endif 553 #endif
552 554
553 } // namespace file_util 555 } // namespace file_util
554 556
555 #endif // BASE_FILE_UTIL_H_ 557 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | base/file_util_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698