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); |
} |