const std = @import("std"); // this generates RC scripts for windows, specifically for // setting the icon of the output binary 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 < 3) @panic("Missing output filename"); const out_path = args[1]; // Generate a startup module function that invokes // startup module for each zig function // and generates an api var writer = std.ArrayList(u8){}; const iconPath = args[2]; try writer.print(allocator, "#include \r\n", .{}); try writer.print(allocator, "IDI_ICON1 ICON \"../../../content/", .{}); //{s}\"", .{iconPath}); for (iconPath) |c| { if (c == '\\') { try writer.append(allocator, '/'); } else { try writer.append(allocator, c); } } try writer.append(allocator, '"'); // 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(writer.items); }