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

Unified Diff: base/file_util_win.cc

Issue 3127008: Preliminary work on resuming downloads whose connections have expired.
Patch Set: Waiting to send download automation error message until after other downloads are canceled. Created 10 years, 3 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
Index: base/file_util_win.cc
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index f538c20c4f847ae243873e65a333dc367bf9065a..03a76fb56763f7b799266cdffebcfed21fd5f752 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -200,9 +200,18 @@ bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) {
::CloseHandle(target_file);
// When writing to a network share, we may not be able to change the ACLs.
// Ignore ACL errors then (REPLACEFILE_IGNORE_MERGE_ERRORS).
- return ::ReplaceFile(to_path.value().c_str(),
+ BOOL replaced = ::ReplaceFile(to_path.value().c_str(),
from_path.value().c_str(), NULL,
- REPLACEFILE_IGNORE_MERGE_ERRORS, NULL, NULL) ? true : false;
+ REPLACEFILE_IGNORE_MERGE_ERRORS, NULL, NULL);
+
+ if (!replaced) {
+ DWORD replace_error = ::GetLastError();
+ DLOG(WARNING) << "Unable to replace file \"" << from_path.value()
+ << "\" with \"" << to_path.value()
+ << "\", error = " << replace_error
+ << " (" << win_util::FormatMessage(replace_error) << ")";
+ }
+ return replaced ? true : false;
}
bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
« no previous file with comments | « no previous file | chrome/app/generated_resources.grd » ('j') | chrome/browser/automation/automation_provider_observers.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698