+ #[cfg(target_os = "windows")]
+ {
+ if dest_file.exists() {
+ unsafe {winapi::um::winbase::ReplaceFileW(
+ path_to_windows_str(dest_file).as_ptr(), path_to_windows_str(tmp_file).as_ptr(), std::ptr::null(),
+ winapi::um::winbase::REPLACEFILE_IGNORE_MERGE_ERRORS,
+ std::ptr::null_mut() as *mut winapi::ctypes::c_void,
+ std::ptr::null_mut() as *mut winapi::ctypes::c_void
+ )};
+ } else {
+ call!(unsafe {winapi::um::winbase::MoveFileExW(
+ path_to_windows_str(tmp_file).as_ptr(), path_to_windows_str(dest_file).as_ptr(),
+ winapi::um::winbase::MOVEFILE_WRITE_THROUGH | winapi::um::winbase::MOVEFILE_REPLACE_EXISTING
+ )});
+ }
+ }