Skip to content

Conversation

@JustinBraben
Copy link
Contributor

Fixes the std.fs related compiler errors mentioned in #20505

Copy link
Collaborator

@linusg linusg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://ziglang.org/documentation/master/std/#std.mem.span seems like the better choice for this

@JustinBraben
Copy link
Contributor Author

Ok! I can rework it.

@JustinBraben
Copy link
Contributor Author

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

@JustinBraben
Copy link
Contributor Author

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);
}

@JustinBraben
Copy link
Contributor Author

@linusg I switched the sliceTo to mem.span . Think it's ready for another look.

@alexrp alexrp requested a review from linusg October 16, 2024 18:05
@alexrp alexrp merged commit 4a2a0f5 into ziglang:master Oct 16, 2024
10 checks passed
richerfu pushed a commit to richerfu/zig that referenced this pull request Oct 28, 2024
* fix compilation errors for fs and fs.Dir

* mem.span instead of mem.sliceTo

* Updating symLinkAbsoluteW function parameters

* Update with expected rename semantics
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants