authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-11 16:25:21-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-12 00:14:08-07:00
logfd4d366009e92c79137ee681334f216bbfc9b5f5
tree1a7c0c600fda53da7de622cca807f61626e7f330
parent818f9cb5a07bec1273d3fc1ecb54e7189a9e6106

std.Build.Cache.Path: fix the format method

This function previously wrote a trailing directory separator, but that's not correct if the path refers to a file.

1 files changed, 7 insertions(+), 2 deletions(-)

lib/std/Build/Cache/Path.zig+7-2
......@@ -157,12 +157,17 @@ pub fn format(
157157 }
158158 if (self.root_dir.path) |p| {
159159 try writer.writeAll(p);
160 try writer.writeAll(fs.path.sep_str);
160 if (self.sub_path.len > 0) {
161 try writer.writeAll(fs.path.sep_str);
162 try writer.writeAll(self.sub_path);
163 }
164 return;
161165 }
162166 if (self.sub_path.len > 0) {
163167 try writer.writeAll(self.sub_path);
164 try writer.writeAll(fs.path.sep_str);
168 return;
165169 }
170 try writer.writeByte('.');
166171}
167172
168173pub fn eql(self: Path, other: Path) bool {