diff options
| author | agulerman <358774453+agulerman@users.noreply.github.com> | 2026-11-23 19:04:42 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-23 10:04:42 -0600 |
| commit | 26fdf4170b1bd062581c38d1f465925eda5528b9 (patch) | |
| tree | ab0edf2465e7f419419ce373c5d4f151c220f7a9 /runtime/shims/file_system.cpp | |
| parent | cc67780893d315ce845c1fa6d13716774f1cb982 (diff) | |
file_system: CopyFile2 falls back to CopyFileExW on Wine 9 (RT-237) (#3655)
Squash-merged after diff review of PR #3655
Diffstat (limited to 'runtime/shims/file_system.cpp')
| -rw-r--r-- | runtime/shims/file_system.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/shims/file_system.cpp b/runtime/shims/file_system.cpp index 1eaf0bda9..a7b64d75c 100644 --- a/runtime/shims/file_system.cpp +++ b/runtime/shims/file_system.cpp | |||
| @@ -415,9 +415,13 @@ Target write_target(const std::wstring& path, bool copy_up) { | |||
| 415 | std::filesystem::create_directories(staging, ec); | 415 | std::filesystem::create_directories(staging, ec); |
| 416 | const std::filesystem::path tmp = | 416 | const std::filesystem::path tmp = |
| 417 | staging / (std::to_wstring(::GetCurrentProcessId()) + L"-" + std::to_wstring(++s_copies)); | 417 | staging / (std::to_wstring(::GetCurrentProcessId()) + L"-" + std::to_wstring(++s_copies)); |
| 418 | if (!ec) std::filesystem::copy_file(package_path, tmp, std::filesystem::copy_options::overwrite_existing, ec); | 418 | // Use CopyFileW for staging because MSVC's std::filesystem::copy_file calls CopyFile2, which Wine 9 lacks. |
| 419 | if (ec) { | 419 | if (ec) { |
| 420 | t.error = static_cast<DWORD>(ec.value()); | 420 | t.error = static_cast<DWORD>(ec.value()); |
| 421 | } else if (!::CopyFileW(package_path.c_str(), tmp.c_str(), FALSE)) { | ||
| 422 | t.error = ::GetLastError(); | ||
| 423 | } | ||
| 424 | if (t.error) { | ||
| 421 | std::filesystem::remove(tmp, ec); | 425 | std::filesystem::remove(tmp, ec); |
| 422 | return t; | 426 | return t; |
| 423 | } | 427 | } |