Function addCopyFile [src]

Place the file into the generated directory within the local cache, along with all the rest of the files added to this step. The parameter here is the destination path relative to the local cache directory associated with this WriteFile. It may be a basename, or it may include sub-directories, in which case this step will ensure the required sub-path exists. This is the option expected to be used most commonly with addCopyFile.

Prototype

pub fn addCopyFile(write_file: *WriteFile, source: std.Build.LazyPath, sub_path: []const u8) std.Build.LazyPath

Parameters

write_file: *WriteFilesource: std.Build.LazyPathsub_path: []const u8

Source

pub fn addCopyFile(write_file: *WriteFile, source: std.Build.LazyPath, sub_path: []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 = .{ .copy = source }, }; write_file.files.append(gpa, file) catch @panic("OOM"); write_file.maybeUpdateName(); source.addStepDependencies(&write_file.step); return .{ .generated = .{ .file = &write_file.generated_directory, .sub_path = file.sub_path, }, }; }