authorgravatar for david@vortan.devDavid Rubin <david@vortan.dev> 2024-03-03 10:56:09-08:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2024-03-26 14:03:39+02:00
log341857e5cd4fd4453cf9c7d1a6679feb66710d84
tree4104298fda513f2bdd609a781a96143347ade428
parent055023efb474acb4a2ff05b28d66a72f3805e34a

make `addCSourceFiles` assert `options.files` are relative


1 files changed, 10 insertions(+), 0 deletions(-)

lib/std/Build/Module.zig+10
......@@ -464,6 +464,16 @@ pub const AddCSourceFilesOptions = struct {
464464pub fn addCSourceFiles(m: *Module, options: AddCSourceFilesOptions) void {
465465 const b = m.owner;
466466 const allocator = b.allocator;
467
468 for (options.files) |path| {
469 if (std.fs.path.isAbsolute(path)) {
470 std.debug.panic(
471 "file paths added with 'addCSourceFiles' must be relative, found absolute path '{s}'",
472 .{path},
473 );
474 }
475 }
476
467477 const c_source_files = allocator.create(CSourceFiles) catch @panic("OOM");
468478 c_source_files.* = .{
469479 .root = options.root,