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

Unified Diff: base/file_util_win.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_posix.cc ('k') | base/platform_file.h » ('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 964302adce55b0cafab153460614e5bc2a81a1f3..47c59cf344f92f00bc39edbb15fbb308aa497c97 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -148,7 +148,9 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) {
return ret;
}
-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();
// Try a simple move first. It will only succeed when |to_path| doesn't
// already exist.
@@ -162,6 +164,8 @@ bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) {
REPLACEFILE_IGNORE_MERGE_ERRORS, NULL, NULL)) {
return true;
}
+ if (error)
+ *error = base::LastErrorToPlatformFileError(GetLastError());
return false;
}
« no previous file with comments | « base/file_util_posix.cc ('k') | base/platform_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698