26 lines
750 B
Zig
26 lines
750 B
Zig
const std = @import("std");
|
|
|
|
pub fn main() !void {
|
|
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
|
|
defer arena.deinit();
|
|
const allocator = arena.allocator();
|
|
|
|
// Get output filename from build system
|
|
const args = try std.process.argsAlloc(allocator);
|
|
if (args.len < 2) @panic("Missing output filename");
|
|
const out_path = args[1];
|
|
|
|
// Generate Zig code content
|
|
const content =
|
|
\\pub const module = @import("module");
|
|
;
|
|
|
|
// Write to specified output file
|
|
// Open or create the file for writing (overwrites if it exists)
|
|
const file = try std.fs.cwd().createFile(out_path, .{});
|
|
defer file.close();
|
|
|
|
// Write the content to the file
|
|
try file.writeAll(content);
|
|
}
|