| ... | @@ -1650,7 +1650,7 @@ pub fn renameatW( | ... | @@ -1650,7 +1650,7 @@ pub fn renameatW( |
| 1650 | new_path_w: [*:0]const u16, | 1650 | new_path_w: [*:0]const u16, |
| 1651 | ReplaceIfExists: windows.BOOLEAN, | 1651 | ReplaceIfExists: windows.BOOLEAN, |
| 1652 | ) RenameError!void { | 1652 | ) RenameError!void { |
| 1653 | const access_mask = windows.SYNCHRONIZE | windows.GENERIC_WRITE; | 1653 | const access_mask = windows.SYNCHRONIZE | windows.GENERIC_WRITE | windows.DELETE; |
| 1654 | const src_fd = try windows.OpenFileW(old_dir_fd, old_path, null, access_mask, windows.FILE_OPEN); | 1654 | const src_fd = try windows.OpenFileW(old_dir_fd, old_path, null, access_mask, windows.FILE_OPEN); |
| 1655 | defer windows.CloseHandle(src_fd); | 1655 | defer windows.CloseHandle(src_fd); |
| 1656 | | 1656 | |
| ... | @@ -1664,7 +1664,7 @@ pub fn renameatW( | ... | @@ -1664,7 +1664,7 @@ pub fn renameatW( |
| 1664 | | 1664 | |
| 1665 | rename_info.* = .{ | 1665 | rename_info.* = .{ |
| 1666 | .ReplaceIfExists = ReplaceIfExists, | 1666 | .ReplaceIfExists = ReplaceIfExists, |
| 1667 | .RootDirectory = if (std.fs.path.isAbsoluteWindowsW(new_path_w)) null else new_dir_fd, | 1667 | .RootDirectory = if (old_dir_fd == new_dir_fd or std.fs.path.isAbsoluteWindowsW(new_path_w)) null else new_dir_fd, |
| 1668 | .FileNameLength = @intCast(u32, new_path.len * 2), // already checked error.NameTooLong | 1668 | .FileNameLength = @intCast(u32, new_path.len * 2), // already checked error.NameTooLong |
| 1669 | .FileName = undefined, | 1669 | .FileName = undefined, |
| 1670 | }; | 1670 | }; |