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.

addCopyDirectory

Copy files matching the specified exclude/include patterns to the specified subdirectory relative to this step's generated directory.

The returned value is a lazy path to the generated subdirectory.

WriteFile.addCopyDirectory
pub fn addCopyDirectory(
    wf: *WriteFile,
    src_path: std.Build.LazyPath,
    sub_path: []const u8,
    options: CopyDirectoryOptions,
) std.Build.LazyPath

File

lib/std/Build/Step/WriteFile.zig:126

Code

pub fn addCopyDirectory(
    wf: *WriteFile,
    src_path: std.Build.LazyPath,
    sub_path: []const u8,
    options: CopyDirectoryOptions,
) std.Build.LazyPath {
    const graph = wf.step.owner.graph;
    const wc = &graph.wip_configuration;
    const arena = graph.arena;

    wf.directories.append(arena, .{
        .sub_path = wc.addString(sub_path) catch @panic("OOM"),
        .src_path = src_path.dupe(graph),
        .exclude_extensions = if (options.exclude_extensions.len != 0)
            .init(wc.addStringList(options.exclude_extensions) catch @panic("OOM"))
        else
            .none,
        .include_extensions = if (options.include_extensions) |list|
            .init(wc.addStringList(list) catch @panic("OOM"))
        else
            .none,
    }) catch @panic("OOM");

    wf.maybeUpdateName();

    src_path.addStepDependencies(&wf.step);

    return .{
        .generated = .{
            .index = wf.generated_directory,
            .sub_path = graph.dupePath(sub_path),
        },
    };
}