format
Function parameters
Parameters
Useful to make `Path` a key in `std.ArrayHashMap`.
Types
- TableAdapter
- Useful to make `Path` a key in `std.ArrayHashMap`.
Functions in this namespace
Functions
- fmtEscapeChar
- Deprecated, use double quoted escape to print paths.
- formatEscapeChar
- Deprecated, use double quoted escape to print paths.
Source
Implementation
pub fn format(self: Path, writer: *std.io.Writer) std.io.Writer.Error!void {
if (std.fs.path.isAbsolute(self.sub_path)) {
try writer.writeAll(self.sub_path);
return;
}
if (self.root_dir.path) |p| {
try writer.writeAll(p);
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);
return;
}
try writer.writeByte('.');
}