DoxigAlpha

add

Function parameters

Parameters

#
write_file:*WriteFile
sub_path:[]const u8
bytes:[]const u8

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
addCopyFile
Place the file into the generated directory within the local cache,
addCopyDirectory
Copy files matching the specified exclude/include patterns to the specified subdirectory
getDirectory
Returns a `LazyPath` representing the base directory that contains all the

= .write_file

Values

#
base_id
= .write_file

Source

Implementation

#
pub fn add(write_file: *WriteFile, sub_path: []const u8, bytes: []const u8) std.Build.LazyPath {
    const b = write_file.step.owner;
    const gpa = b.allocator;
    const file = File{
        .sub_path = b.dupePath(sub_path),
        .contents = .{ .bytes = b.dupe(bytes) },
    };
    write_file.files.append(gpa, file) catch @panic("OOM");
    write_file.maybeUpdateName();
    return .{
        .generated = .{
            .file = &write_file.generated_directory,
            .sub_path = file.sub_path,
        },
    };
}