Skip to content

Conversation

@andrewrk
Copy link
Member

This is @squeek502's pull request #4655 with a couple of additional modifications.

@squeek502 does this look OK to you?

I also plan on looking into making "." and ".." work in the code that calls NtCreateFile but I agree with you that can be a separate issue.

squeek502 and others added 3 commits April 27, 2020 13:35
This is a band-aid fix due to NtCreateFile failing on paths with . or .. in them.
The previous commit made zig fmt print absolute paths; this commit keeps
the absolute path resolution but still prints the relative paths to
stdout.
@andrewrk andrewrk changed the title zig fmt: Fix relative paths with . and .. on Windows zig fmt: Fix relative paths with . and .. on Windows as well as forward slashes Apr 27, 2020
@squeek502
Copy link
Member

Looks good to me. 👍

@andrewrk andrewrk merged commit ecdf75d into master Apr 27, 2020
@andrewrk andrewrk deleted the squeek502-windows-fmt-relative branch April 27, 2020 22:28

const max = std.math.maxInt(usize);
const source_code = fs.cwd().readFileAlloc(fmt.allocator, file_path, max) catch |err| switch (err) {
const source_code = fs.cwd().readFileAlloc(fmt.allocator, real_path, self_hosted_main.max_src_size) catch |err| switch (err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't real_path an absolute path? Why call fs.cwd()?

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.

3 participants