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.
This commit is contained in:
Andrew Kelley 2024-07-11 16:25:21 -07:00
parent 818f9cb5a0
commit fd4d366009

View File

@ -157,12 +157,17 @@ pub fn format(
}
if (self.root_dir.path) |p| {
try writer.writeAll(p);
try writer.writeAll(fs.path.sep_str);
if (self.sub_path.len > 0) {
try writer.writeAll(fs.path.sep_str);
try writer.writeAll(self.sub_path);
}
return;
}
if (self.sub_path.len > 0) {
try writer.writeAll(self.sub_path);
try writer.writeAll(fs.path.sep_str);
return;
}
try writer.writeByte('.');
}
pub fn eql(self: Path, other: Path) bool {