Commit a27a8561e9

Andrew Kelley <andrew@ziglang.org>
2020-03-15 22:26:29
adjust renameatW to always supply dest root dir
this fixes tests for wine
1 parent 7e45a3e
Changed files (2)
lib/std/mem.zig
@@ -116,7 +116,7 @@ pub const Allocator = struct {
     pub fn allocSentinel(self: *Allocator, comptime Elem: type, n: usize, comptime sentinel: Elem) Error![:sentinel]Elem {
         var ptr = try self.alloc(Elem, n + 1);
         ptr[n] = sentinel;
-        return ptr[0 .. n :sentinel];
+        return ptr[0..n :sentinel];
     }
 
     pub fn alignedAlloc(
lib/std/os.zig
@@ -1664,7 +1664,7 @@ pub fn renameatW(
 
     rename_info.* = .{
         .ReplaceIfExists = ReplaceIfExists,
-        .RootDirectory = if (old_dir_fd == new_dir_fd or std.fs.path.isAbsoluteWindowsW(new_path_w)) null else new_dir_fd,
+        .RootDirectory = if (std.fs.path.isAbsoluteWindowsW(new_path_w)) null else new_dir_fd,
         .FileNameLength = @intCast(u32, new_path.len * 2), // already checked error.NameTooLong
         .FileName = undefined,
     };