diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-04-27 13:38:19 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-04-27 13:38:19 -0400 |
| commit | 41e17106cdcb0bc19f26ef67ebe2d98d920ee21b (patch) | |
| tree | 5097dd7ccdadda390fca0e43c03ab0b504a9ef24 /src-self-hosted | |
| parent | fdff381a5644d5e12519ca53012d7b00a33a33c4 (diff) | |
| download | zig-41e17106cdcb0bc19f26ef67ebe2d98d920ee21b.tar.gz zig-41e17106cdcb0bc19f26ef67ebe2d98d920ee21b.zip | |
zig fmt: still print the relative path
The previous commit made zig fmt print absolute paths; this commit keeps
the absolute path resolution but still prints the relative paths to
stdout.
Diffstat (limited to 'src-self-hosted')
| -rw-r--r-- | src-self-hosted/stage2.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src-self-hosted/stage2.zig b/src-self-hosted/stage2.zig index 5c469e4c89..38ab49ccc4 100644 --- a/src-self-hosted/stage2.zig +++ b/src-self-hosted/stage2.zig @@ -339,7 +339,7 @@ fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool) FmtError!void { while (try dir_it.next()) |entry| { if (entry.kind == .Directory or mem.endsWith(u8, entry.name, ".zig")) { - const full_path = try fs.path.join(fmt.allocator, &[_][]const u8{ real_path, entry.name }); + const full_path = try fs.path.join(fmt.allocator, &[_][]const u8{ file_path, entry.name }); try fmtPath(fmt, full_path, check_mode); } } @@ -377,7 +377,7 @@ fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool) FmtError!void { fmt.any_error = true; } } else { - const baf = try io.BufferedAtomicFile.create(fmt.allocator, real_path); + const baf = try io.BufferedAtomicFile.create(fmt.allocator, fs.cwd(), real_path, .{}); defer baf.destroy(); const anything_changed = try std.zig.render(fmt.allocator, baf.stream(), tree); |
