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

Unified Diff: base/file_util_posix.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.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 8723333f906a8fd4931628a22d99d913442d06d0..5d037bf2498ffeaa03117393a67c28c05d389095 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -518,7 +518,8 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix,
return CreateTemporaryDirInDirImpl(tmpdir, TempFileName(), new_temp_path);
}
-bool CreateDirectory(const FilePath& full_path) {
+bool CreateDirectoryAndGetError(const FilePath& full_path,
+ base::PlatformFileError* error) {
base::ThreadRestrictions::AssertIOAllowed(); // For call to mkdir().
std::vector<FilePath> subpaths;
@@ -542,8 +543,12 @@ bool CreateDirectory(const FilePath& full_path) {
// due to the the directory appearing out of thin air. This can occur if
// two processes are trying to create the same file system tree at the same
// time. Check to see if it exists and make sure it is a directory.
- if (!DirectoryExists(*i))
+ int saved_errno = errno;
+ if (!DirectoryExists(*i)) {
+ if (error)
+ *error = base::ErrnoToPlatformFileError(saved_errno);
return false;
+ }
}
return true;
}
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698