zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 089ebeb8736e9186c14d8228fa5594c518dcdb4b (tree)
parent 6405d37d9f07565d40a8412badafebd44003ed01
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Sun,  7 Jan 2024 22:15:28 -0700

update-mingw tool: add config.h to whitelist

Diffstat:
Mtools/update_mingw.zig | 18+++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/update_mingw.zig b/tools/update_mingw.zig @@ -45,13 +45,16 @@ pub fn main() !void { while (try walker.next()) |entry| { if (entry.kind != .file) continue; - // Special exception to keep the copyright file. - if (std.mem.eql(u8, entry.path, "COPYING")) continue; - src_crt_dir.copyFile(entry.path, dest_crt_dir, entry.path, .{}) catch |err| switch (err) { error.FileNotFound => { - std.log.warn("deleting {s}", .{entry.path}); - try dest_crt_dir.deleteFile(entry.path); + const whitelisted = for (whitelist) |item| { + if (std.mem.eql(u8, entry.path, item)) break true; + } else false; + + if (!whitelisted) { + std.log.warn("deleting {s}", .{entry.path}); + try dest_crt_dir.deleteFile(entry.path); + } }, else => { std.log.err("unable to copy {s}: {s}", .{ entry.path, @errorName(err) }); @@ -105,6 +108,11 @@ pub fn main() !void { return std.process.cleanExit(); } +const whitelist = [_][]const u8{ + "COPYING", + "include" ++ std.fs.path.sep_str ++ "config.h", +}; + const ok_exts = [_][]const u8{ ".def", ".def.in",