| ... | ... | @@ -797,17 +797,15 @@ int os_rename(Buf *src_path, Buf *dest_path) { |
| 797 | 797 | if (buf_eql_buf(src_path, dest_path)) { |
| 798 | 798 | return 0; |
| 799 | 799 | } |
| 800 | #if defined(ZIG_OS_WINDOWS) |
| 801 | if (!MoveFileEx(buf_ptr(dest_path), buf_ptr(src_path), MOVEFILE_REPLACE_EXISTING)) { |
| 802 | return ErrorFileSystem; |
| 803 | } |
| 804 | #else |
| 800 | 805 | if (rename(buf_ptr(src_path), buf_ptr(dest_path)) == -1) { |
| 801 | | // Windows requires the dest path to be missing |
| 802 | | if (errno == EACCES) { |
| 803 | | remove(buf_ptr(dest_path)); |
| 804 | | if (rename(buf_ptr(src_path), buf_ptr(dest_path)) == -1) { |
| 805 | | return ErrorFileSystem; |
| 806 | | } |
| 807 | | return 0; |
| 808 | | } |
| 809 | 806 | return ErrorFileSystem; |
| 810 | 807 | } |
| 808 | #endif |
| 811 | 809 | return 0; |
| 812 | 810 | } |
| 813 | 811 | |