Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

stripRoot

Strips root directory name from file system path.

Fetch.stripRoot
fn stripRoot(fs_path: []const u8, root_dir: []const u8) []const u8

File

lib/compiler/Maker/Fetch.zig:1979

Code

fn stripRoot(fs_path: []const u8, root_dir: []const u8) []const u8 {
    if (root_dir.len == 0 or fs_path.len <= root_dir.len) return fs_path;

    if (std.mem.eql(u8, fs_path[0..root_dir.len], root_dir) and fs.path.isSep(fs_path[root_dir.len])) {
        return fs_path[root_dir.len + 1 ..];
    }

    return fs_path;
}