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

Unified Diff: runtime/bin/file_win.cc

Issue 17848003: dart:io | Add rename to Link (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix again 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 | « runtime/bin/file_patch.dart ('k') | sdk/lib/_internal/lib/io_patch.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 723bd6ce20696917031dacb908d9d600a7667166..08417ea9ac03220bc7d83a648c42ef3a9b7f8260 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -297,8 +297,24 @@ bool File::Rename(const char* old_path, const char* new_path) {
free(const_cast<wchar_t*>(system_old_path));
free(const_cast<wchar_t*>(system_new_path));
return (move_status != 0);
- } else if (type == kIsDirectory) {
+ } else {
SetLastError(ERROR_FILE_NOT_FOUND);
+ }
+ return false;
+}
+
+
+bool File::RenameLink(const char* old_path, const char* new_path) {
+ File::Type type = GetType(old_path, false);
+ 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;
+ int move_status =
+ MoveFileExW(system_old_path, system_new_path, flags);
+ free(const_cast<wchar_t*>(system_old_path));
+ free(const_cast<wchar_t*>(system_new_path));
+ return (move_status != 0);
} else {
SetLastError(ERROR_FILE_NOT_FOUND);
}
« no previous file with comments | « runtime/bin/file_patch.dart ('k') | sdk/lib/_internal/lib/io_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698