From 1c4f4e4c905183062173b0a75d94cfcac1a52101 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Tue, 23 Aug 2022 08:16:13 -0700 Subject: [PATCH] ev: add script ensuring standard files across subprojects Signed-off-by: Stephen Gutekanst --- dev/ensure-standard-files.zig | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 dev/ensure-standard-files.zig diff --git a/dev/ensure-standard-files.zig b/dev/ensure-standard-files.zig new file mode 100644 index 00000000..9b1389ba --- /dev/null +++ b/dev/ensure-standard-files.zig @@ -0,0 +1,28 @@ +//! Usage: zig run ./dev/ensure-standard-files.zig + +const std = @import("std"); + +const dirs = [_][]const u8{ + ".", + "basisu", + "ecs", + "freetype", + "gamemode", + "glfw", + "gpu", + "gpu-dawn", + "sysaudio", + "sysjs", +}; + +pub fn main() !void { + inline for (dirs) |dir| { + copyFile("dev/template/LICENSE", dir ++ "/LICENSE"); + copyFile("dev/template/LICENSE-MIT", dir ++ "/LICENSE-MIT"); + copyFile("dev/template/LICENSE-APACHE", dir ++ "/LICENSE-APACHE"); + } +} + +pub fn copyFile(src_path: []const u8, dst_path: []const u8) void { + std.fs.cwd().copyFile(src_path, std.fs.cwd(), dst_path, .{}) catch unreachable; +}