addCopyFile
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.
Function parameters
Parameters
- write_file:*WriteFile
- source:std.Build.LazyPath
- sub_path:[]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 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,
},
};
}