diff options
| author | David Rubin <daviru007@icloud.com> | 2024-03-03 10:56:09 -0800 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2024-03-26 14:03:39 +0200 |
| commit | 341857e5cd4fd4453cf9c7d1a6679feb66710d84 (patch) | |
| tree | 4104298fda513f2bdd609a781a96143347ade428 /lib/std/Build/Module.zig | |
| parent | 055023efb474acb4a2ff05b28d66a72f3805e34a (diff) | |
| download | zig-341857e5cd4fd4453cf9c7d1a6679feb66710d84.tar.gz zig-341857e5cd4fd4453cf9c7d1a6679feb66710d84.zip | |
make `addCSourceFiles` assert `options.files` are relative
Diffstat (limited to 'lib/std/Build/Module.zig')
| -rw-r--r-- | lib/std/Build/Module.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig index 12cbda39a0..46c6a19578 100644 --- a/lib/std/Build/Module.zig +++ b/lib/std/Build/Module.zig @@ -464,6 +464,16 @@ pub const AddCSourceFilesOptions = struct { pub fn addCSourceFiles(m: *Module, options: AddCSourceFilesOptions) void { const b = m.owner; const allocator = b.allocator; + + for (options.files) |path| { + if (std.fs.path.isAbsolute(path)) { + std.debug.panic( + "file paths added with 'addCSourceFiles' must be relative, found absolute path '{s}'", + .{path}, + ); + } + } + const c_source_files = allocator.create(CSourceFiles) catch @panic("OOM"); c_source_files.* = .{ .root = options.root, |
