pub fn format(self: Path, writer: *Io.Writer) Io.Writer.Error!void 179
180
181
182
183
184
185
186
187
188
189
190pub fn format(self: Path, writer: *Io.Writer) Io.Writer.Error!void {
if (Io.Dir.path.isAbsolute(self.sub_path)) {
return writer.writeAll(self.sub_path);
} else if (self.root_dir.path) |p| {
var bufs: [3][]const u8 = .{ p, Io.Dir.path.sep_str, self.sub_path };
return writer.writeVecAll(bufs[0..if (self.sub_path.len > 0) 3 else 1]);
} else if (self.sub_path.len > 0) {
return writer.writeAll(self.sub_path);
} else {
return writer.writeByte('.');
}
}