DoxigAlpha

addPathDir

Function parameters

Parameters

#
run:*Run
search_path:[]const u8

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
addOutputFileArg
Provides a file path as a command line argument to the command being run.
addPrefixedOutputFileArg
Provides a file path as a command line argument to the command being run.
addFileArg
Appends an input file to the command line arguments.
addPrefixedFileArg
Appends an input file to the command line arguments prepended with a string.
addOutputDirectoryArg
Provides a directory path as a command line argument to the command being run.
addPrefixedOutputDirectoryArg
Provides a directory path as a command line argument to the command being run.
addDepFileOutputArg
Add a path argument to a dep file (.d) for the child process to write its
addPrefixedDepFileOutputArg
Add a prefixed path argument to a dep file (.d) for the child process to
expectStdErrEqual
Adds a check for exact stderr match.
expectStdOutEqual
Adds a check for exact stdout match as well as a check for exit code 0, if
addFileInput
Adds an additional input files that, when modified, indicates that this Run

= .run

Values

#
base_id
= .run

Source

Implementation

#
pub fn addPathDir(run: *Run, search_path: []const u8) void {
    const b = run.step.owner;
    const env_map = getEnvMapInternal(run);

    const use_wine = b.enable_wine and b.graph.host.result.os.tag != .windows and use_wine: switch (run.argv.items[0]) {
        .artifact => |p| p.artifact.rootModuleTarget().os.tag == .windows,
        .lazy_path => |p| {
            switch (p.lazy_path) {
                .generated => |g| if (g.file.step.cast(Step.Compile)) |cs| break :use_wine cs.rootModuleTarget().os.tag == .windows,
                else => {},
            }
            break :use_wine std.mem.endsWith(u8, p.lazy_path.basename(b, &run.step), ".exe");
        },
        .decorated_directory => false,
        .bytes => |bytes| std.mem.endsWith(u8, bytes, ".exe"),
        .output_file, .output_directory => false,
    };
    const key = if (use_wine) "WINEPATH" else "PATH";
    const prev_path = env_map.get(key);

    if (prev_path) |pp| {
        const new_path = b.fmt("{s}{c}{s}", .{
            pp,
            if (use_wine) fs.path.delimiter_windows else fs.path.delimiter,
            search_path,
        });
        env_map.put(key, new_path) catch @panic("OOM");
    } else {
        env_map.put(key, b.dupePath(search_path)) catch @panic("OOM");
    }
}