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

Unified Diff: base/file_util_posix.cc

Issue 14886003: Make base:ReplaceFile return an informative error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ToT 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 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 8b368127410e091eb392cf440f2bd9c50a417acd..7ef09a200de29c96c1f3f49e7002e50798488ec0 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -232,9 +232,15 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) {
return true;
}
-bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) {
+bool ReplaceFileAndGetError(const FilePath& from_path,
+ const FilePath& to_path,
+ base::PlatformFileError* error) {
base::ThreadRestrictions::AssertIOAllowed();
- return (rename(from_path.value().c_str(), to_path.value().c_str()) == 0);
+ if (rename(from_path.value().c_str(), to_path.value().c_str()) == 0)
+ return true;
+ if (error)
+ *error = base::ErrnoToPlatformFileError(errno);
+ return false;
}
bool CopyDirectory(const FilePath& from_path,
« 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