mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
make addCSourceFiles assert options.files are relative
This commit is contained in:
parent
055023efb4
commit
341857e5cd
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user