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

Side by Side Diff: base/file_util.h

Issue 15812007: Make file_util::CreateDirectory return an error, not just a bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: xml file; use the new errors Created 7 years, 6 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.cc » ('j') | base/file_util_win.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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // Extra characters will be appended to |prefix| to ensure that the 263 // Extra characters will be appended to |prefix| to ensure that the
264 // new directory does not have the same name as an existing directory. 264 // new directory does not have the same name as an existing directory.
265 BASE_EXPORT bool CreateTemporaryDirInDir( 265 BASE_EXPORT bool CreateTemporaryDirInDir(
266 const base::FilePath& base_dir, 266 const base::FilePath& base_dir,
267 const base::FilePath::StringType& prefix, 267 const base::FilePath::StringType& prefix,
268 base::FilePath* new_dir); 268 base::FilePath* new_dir);
269 269
270 // Creates a directory, as well as creating any parent directories, if they 270 // Creates a directory, as well as creating any parent directories, if they
271 // don't exist. Returns 'true' on successful creation, or if the directory 271 // don't exist. Returns 'true' on successful creation, or if the directory
272 // already exists. The directory is only readable by the current user. 272 // already exists. The directory is only readable by the current user.
273 // Returns true on success, leaving *error unchanged.
274 // Returns false on failure and sets *error appropriately, if it is non-NULL.
275 BASE_EXPORT bool CreateDirectoryAndGetError(const base::FilePath& full_path,
276 base::PlatformFileError* error);
277
278 // Backward-compatible convenience method for the above.
273 BASE_EXPORT bool CreateDirectory(const base::FilePath& full_path); 279 BASE_EXPORT bool CreateDirectory(const base::FilePath& full_path);
274 280
275 // Returns the file size. Returns true on success. 281 // Returns the file size. Returns true on success.
276 BASE_EXPORT bool GetFileSize(const base::FilePath& file_path, int64* file_size); 282 BASE_EXPORT bool GetFileSize(const base::FilePath& file_path, int64* file_size);
277 283
278 // Sets |real_path| to |path| with symbolic links and junctions expanded. 284 // Sets |real_path| to |path| with symbolic links and junctions expanded.
279 // On windows, make sure the path starts with a lettered drive. 285 // On windows, make sure the path starts with a lettered drive.
280 // |path| must reference a file. Function will fail if |path| points to 286 // |path| must reference a file. Function will fail if |path| points to
281 // a directory or to a nonexistent path. On windows, this function will 287 // a directory or to a nonexistent path. On windows, this function will
282 // fail if |path| is a junction or symlink that points to an empty file, 288 // fail if |path| is a junction or symlink that points to an empty file,
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 558
553 // Attempts determine the FileSystemType for |path|. 559 // Attempts determine the FileSystemType for |path|.
554 // Returns false if |path| doesn't exist. 560 // Returns false if |path| doesn't exist.
555 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path, 561 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path,
556 FileSystemType* type); 562 FileSystemType* type);
557 #endif 563 #endif
558 564
559 } // namespace file_util 565 } // namespace file_util
560 566
561 #endif // BASE_FILE_UTIL_H_ 567 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util.cc » ('j') | base/file_util_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698