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.

checkBuildFileExistence

computeHash gets a free check for the existence of build.zig, but when not computing a hash, we need to do a syscall to check for it.

Fetch.checkBuildFileExistence
fn checkBuildFileExistence(f: *Fetch) RunError!void

File

lib/compiler/Maker/Fetch.zig:856

Code

fn checkBuildFileExistence(f: *Fetch) RunError!void {
    const io = f.job_queue.io;
    const eb = &f.error_bundle;
    if (f.package_root.access(io, std.zig.build_zig_basename, .{})) |_| {
        f.has_build_zig = true;
    } else |err| switch (err) {
        error.FileNotFound => {},
        else => |e| {
            try eb.addRootErrorMessage(.{
                .msg = try eb.printString("unable to access {f}/{s}: {t}", .{
                    f.package_root, std.zig.build_zig_basename, e,
                }),
            });
            return error.FetchFailed;
        },
    }
}