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

Unified Diff: runtime/bin/file_win.cc

Issue 28553006: dart:io | Fix File.rename on Windows to overwrite an existing target. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix previously existing problem in test. Created 7 years, 2 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 | « no previous file | tests/standalone/io/file_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_win.cc
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
index e7cedb47b43804fa374db09df31a80e42b9e3319..8e0f6157157ecec66e600990691f647515e833a4 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -291,7 +291,7 @@ bool File::Rename(const char* old_path, const char* new_path) {
if (type == kIsFile) {
const wchar_t* system_old_path = StringUtils::Utf8ToWide(old_path);
const wchar_t* system_new_path = StringUtils::Utf8ToWide(new_path);
- DWORD flags = MOVEFILE_WRITE_THROUGH;
+ DWORD flags = MOVEFILE_WRITE_THROUGH | MOVEFILE_REPLACE_EXISTING;
int move_status =
MoveFileExW(system_old_path, system_new_path, flags);
free(const_cast<wchar_t*>(system_old_path));
@@ -309,7 +309,7 @@ bool File::RenameLink(const char* old_path, const char* new_path) {
if (type == kIsLink) {
const wchar_t* system_old_path = StringUtils::Utf8ToWide(old_path);
const wchar_t* system_new_path = StringUtils::Utf8ToWide(new_path);
- DWORD flags = MOVEFILE_WRITE_THROUGH;
+ DWORD flags = MOVEFILE_WRITE_THROUGH | MOVEFILE_REPLACE_EXISTING;
int move_status =
MoveFileExW(system_old_path, system_new_path, flags);
free(const_cast<wchar_t*>(system_old_path));
« no previous file with comments | « no previous file | tests/standalone/io/file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698