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

Unified Diff: base/file_util_win.cc

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: call the right function on windows 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util_posix.cc ('k') | third_party/leveldatabase/env_chromium.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_win.cc
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 05662478e87455c6c2eedab29753a4376aea34b6..43af52967920c88f16bf13e43d83f1bbb12f67b5 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -403,7 +403,8 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix,
return CreateTemporaryDirInDir(system_temp_dir, prefix, new_temp_path);
}
-bool CreateDirectory(const FilePath& full_path) {
+bool CreateDirectoryAndGetError(const FilePath& full_path,
+ base::PlatformFileError* error) {
base::ThreadRestrictions::AssertIOAllowed();
// If the path exists, we've succeeded if it's a directory, failed otherwise.
@@ -429,7 +430,7 @@ bool CreateDirectory(const FilePath& full_path) {
if (parent_path.value() == full_path.value()) {
return false;
}
- if (!CreateDirectory(parent_path)) {
+ if (!CreateDirectoryAndGetError(parent_path, error)) {
DLOG(WARNING) << "Failed to create one of the parent directories.";
return false;
}
@@ -443,6 +444,8 @@ bool CreateDirectory(const FilePath& full_path) {
// race to create the same directory.
return true;
} else {
+ if (error)
+ *error = base::LastErrorToPlatformFileError(error_code);
DLOG(WARNING) << "Failed to create directory " << full_path_str
<< ", last error is " << error_code << ".";
return false;
« no previous file with comments | « base/file_util_posix.cc ('k') | third_party/leveldatabase/env_chromium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698