Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

addFileArg2

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

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:

Params

File

Build/Step/Run.zig:370
370
371
372
373
374
375
376
377
378
379
380
381
382
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);
}