From a27a8561e9387b22d7c694af924e8f2ed0f17290 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 15 Mar 2020 17:26:29 -0400 Subject: [PATCH] adjust renameatW to always supply dest root dir this fixes tests for wine --- lib/std/mem.zig | 2 +- lib/std/os.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/mem.zig b/lib/std/mem.zig index 9d2232d3eb..438c15c2eb 100644 --- a/lib/std/mem.zig +++ b/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( diff --git a/lib/std/os.zig b/lib/std/os.zig index 5a56224e61..377f7d7077 100644 --- a/lib/std/os.zig +++ b/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, };