Skip to content

Commit

Permalink
make addCSourceFiles assert options.files are relative
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexicon226 authored and Vexu committed Mar 26, 2024
1 parent 055023e commit 341857e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/std/Build/Module.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 341857e

Please sign in to comment.