dev: correct freetype .gitignore generation

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-10-16 07:47:10 -07:00 committed by Stephen Gutekanst
parent 6cb0d6236f
commit 1f777759b3

View file

@ -36,6 +36,8 @@ pub fn main() !void {
} }
copyFile("dev/template/.github/FUNDING.yml", libs ++ project ++ "/.github/FUNDING.yml"); copyFile("dev/template/.github/FUNDING.yml", libs ++ project ++ "/.github/FUNDING.yml");
} }
appendToFile("libs/freetype/.gitignore", "\n/out.svg\n");
} }
pub fn copyFile(src_path: []const u8, dst_path: []const u8) void { pub fn copyFile(src_path: []const u8, dst_path: []const u8) void {
@ -49,3 +51,10 @@ pub fn replaceInFile(file_path: []const u8, needle: []const u8, replacement: []c
const new_data = std.mem.replaceOwned(u8, allocator, data, needle, replacement) catch unreachable; const new_data = std.mem.replaceOwned(u8, allocator, data, needle, replacement) catch unreachable;
std.fs.cwd().writeFile(file_path, new_data) catch unreachable; std.fs.cwd().writeFile(file_path, new_data) catch unreachable;
} }
pub fn appendToFile(file_path: []const u8, data: []const u8) void {
const file = std.fs.cwd().openFile(file_path, .{ .mode = .write_only }) catch unreachable;
defer file.close();
file.seekFromEnd(0) catch unreachable;
_ = file.write(data) catch unreachable;
}