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.

addFileArg2

Appends an input file to the command line arguments prepended with a string.

For example, a prefix of "-F" will result in the child process seeing something like this: "-Fexample.txt"

The child process will see a single argument, even if the prefix has spaces. Modifications to this file will be detected as a cache miss in subsequent builds, causing the child process to be re-executed.

Related:

Run.addFileArg2
pub fn addFileArg2(run: *Run, lp: std.Build.LazyPath, options: PathArgOptions) void

File

Code

pub fn addFileArg2(run: *Run, lp: std.Build.LazyPath, options: PathArgOptions) void {
    const graph = run.step.owner.graph;
    const arena = graph.arena;

    const prefixed_file_source: DecoratedLazyPath = .{
        .prefix = graph.dupeString(options.prefix),
        .lazy_path = lp.dupe(graph),
        .suffix = graph.dupeString(options.suffix),
        .make_absolute = options.make_absolute,
    };
    run.argv.append(arena, .{ .lazy_path = prefixed_file_source }) catch @panic("OOM");
    lp.addStepDependencies(&run.step);
}