This commit is contained in:
Dario48 2026-06-20 18:56:00 +02:00
commit 432151cc40

View file

@ -98,6 +98,9 @@ const opts = struct {
width: f32 = 1280,
height: f32 = 800,
zonPath: []const u8 = ".",
pub fn format(self: @This(), writer: *std.Io.Writer) std.Io.Writer.Error!void {
try writer.print("opts{{vsync = {}, fullscreen = {}, light = {}, classic = {}, width = {}, height = {}, zonPath = {s}}}", .{ self.vsync, self.fullscreen, self.light, self.classic, self.width, self.height, self.zonPath });
}
};
var args: opts = .{};
@ -150,14 +153,17 @@ pub fn main(init: std.process.Init) !void {
else {
if (std.mem.cutScalar(u8, i, '=')) |v| {
const opt, const value = v;
std.log.debug("opt: {s}, value: {s}", .{ opt, value });
if (floatOptMap.get(opt)) |o|
o.* = try std.fmt.parseFloat(f32, value)
else if (std.mem.eql(u8, opt, "zonPath"))
else if (std.mem.eql(u8, opt, "--zonPath"))
args.zonPath = value;
}
}
}
std.log.debug("{f}", .{args});
const file = std.Io.Dir.cwd().openFile(init.io, args.zonPath, .{ .allow_directory = false }) catch |err| switch (err) {
error.IsDir => blk: {
const dir = try std.Io.Dir.cwd().openDir(init.io, args.zonPath, .{});