size: 466 B
| 1 | const std = @import("std"); |
| 2 | const fs = std.fs; |
| 3 | const json = std.json; |
| 4 | const mem = std.mem; |
| 5 | |
| 6 | pub const file_path = "_loa_meta.json"; |
| 7 | |
| 8 | const Meta = @This(); |
| 9 | |
| 10 | site_name: []const u8, |
| 11 | tagline: []const u8, |
| 12 | domain: []const u8, |
| 13 | |
| 14 | pub fn load(arena: mem.Allocator, dir: fs.Dir) !Meta { |
| 15 | const meta_text = try dir.readFileAlloc(arena, file_path, 1024 * 16); |
| 16 | |
| 17 | return try json.parseFromSliceLeaky(Meta, arena, meta_text, .{ |
| 18 | .allocate = .alloc_if_needed, |
| 19 | }); |
| 20 | } |