| ... | ... | @@ -794,7 +794,18 @@ int os_delete_file(Buf *path) { |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | int os_rename(Buf *src_path, Buf *dest_path) { |
| 797 | if (buf_eql_buf(src_path, dest_path)) { |
| 798 | return 0; |
| 799 | } |
| 797 | 800 | 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 | } |
| 798 | 809 | return ErrorFileSystem; |
| 799 | 810 | } |
| 800 | 811 | return 0; |