DoxigAlpha

openFile

Function parameters

Parameters

#
sub_path:[]const u8
flags:fs.File.OpenFlags

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 openFile(
    p: Path,
    sub_path: []const u8,
    flags: fs.File.OpenFlags,
) !fs.File {
    var buf: [fs.max_path_bytes]u8 = undefined;
    const joined_path = if (p.sub_path.len == 0) sub_path else p: {
        break :p std.fmt.bufPrint(&buf, "{s}" ++ fs.path.sep_str ++ "{s}", .{
            p.sub_path, sub_path,
        }) catch return error.NameTooLong;
    };
    return p.root_dir.handle.openFile(joined_path, flags);
}