| ... | @@ -464,6 +464,16 @@ pub const AddCSourceFilesOptions = struct { | ... | @@ -464,6 +464,16 @@ pub const AddCSourceFilesOptions = struct { |
| 464 | pub fn addCSourceFiles(m: *Module, options: AddCSourceFilesOptions) void { | 464 | pub fn addCSourceFiles(m: *Module, options: AddCSourceFilesOptions) void { |
| 465 | const b = m.owner; | 465 | const b = m.owner; |
| 466 | const allocator = b.allocator; | 466 | 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 | |
| 467 | const c_source_files = allocator.create(CSourceFiles) catch @panic("OOM"); | 477 | const c_source_files = allocator.create(CSourceFiles) catch @panic("OOM"); |
| 468 | c_source_files.* = .{ | 478 | c_source_files.* = .{ |
| 469 | .root = options.root, | 479 | .root = options.root, |