I'm trying to load a config file from my assets using a .zon file, and while I was able to figure out what to use, I do not know how to use it I have tried
const std = @import("std");
pub const Config = struct {
name: [:0]u8,
resolution: @Vector(2, u16),
aspect_ratio_mode: u4,
resolution_mode: u4,
version: [:0]u8,
pub fn get_config(alloc: std.mem.Allocator) !Config {
const code = try std.fs.cwd().readFileAlloc(alloc, "assets/.project.zon", 1000000000);
return try std.zon.parse.fromSlice(Config, alloc, @ptrCast(code), null, .{ .free_on_error = true });
}
};
and
const std = @import("std");
pub const Config = struct {
name: [:0]u8,
resolution: @Vector(2, u16),
aspect_ratio_mode: u4,
resolution_mode: u4,
version: [:0]u8,
pub fn get_config(alloc: std.mem.Allocator) !Config {
return try std.zon.parse.fromSlice(Config, alloc, "assets/.project.zon", null, .{ .free_on_error = true });
}
};
I know that I'm doing something wrong, but I'm not sure what I'm doing wrong since I can't find any documentation
