Index: runtime/bin/file_win.cc |
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc |
index 4c3c853d5c50b60efbc9c8586d3f2ef0df91cab0..1be41cbbea81dc8aa216b4774b6a13f61113cd9a 100644 |
--- a/runtime/bin/file_win.cc |
+++ b/runtime/bin/file_win.cc |
@@ -322,6 +322,27 @@ bool File::RenameLink(const char* old_path, const char* new_path) { |
} |
+bool File::Copy(const char* old_path, const char* new_path) { |
+ File::Type type = GetType(old_path, false); |
+ if (type == kIsFile) { |
+ const wchar_t* system_old_path = StringUtils::Utf8ToWide(old_path); |
+ const wchar_t* system_new_path = StringUtils::Utf8ToWide(new_path); |
+ bool success = CopyFileExW(system_old_path, |
+ system_new_path, |
+ NULL, |
+ NULL, |
+ NULL, |
+ 0) != 0; |
+ free(const_cast<wchar_t*>(system_old_path)); |
+ free(const_cast<wchar_t*>(system_new_path)); |
+ return success; |
+ } else { |
+ SetLastError(ERROR_FILE_NOT_FOUND); |
+ } |
+ return false; |
+} |
+ |
+ |
off64_t File::LengthFromPath(const char* name) { |
struct __stat64 st; |
const wchar_t* system_name = StringUtils::Utf8ToWide(name); |