zig
zig copied to clipboard
fix compilation errors for fs and fs.Dir
Fixes the std.fs related compiler errors mentioned in #20505
Ok! I can rework it.
Worth mentioning I got the original mem.sliceTo(path_w, 0) from the function isAbsoluteWindowsW , which is asserted before most of these W calls.
pub fn isAbsoluteWindowsW(path_w: [*:0]const u16) bool {
return isAbsoluteWindowsImpl(u16, mem.sliceTo(path_w, 0));
}
Should that be changed to:
pub fn isAbsoluteWindowsW(path_w: [*:0]const u16) bool {
return isAbsoluteWindowsImpl(u16, mem.span(path_w));
}
Ok if that is outside the scope for this PR though
Ok landed on this
pub fn symLinkAbsoluteW(
target_path_w: [*:0]const u16,
sym_link_path_w: [*:0]const u16,
flags: Dir.SymLinkFlags,
) !void {
assert(path.isAbsoluteWindowsW(target_path_w));
assert(path.isAbsoluteWindowsW(sym_link_path_w));
return windows.CreateSymbolicLink(null, mem.span(sym_link_path_w), mem.span(target_path_w), flags.is_directory);
}
@linusg I switched the sliceTo to mem.span . Think it's ready for another look.