From 432151cc404468053194133098ecb7ad13d3177c Mon Sep 17 00:00:00 2001 From: Dario48 Date: Sat, 20 Jun 2026 18:56:00 +0200 Subject: [PATCH] fix args --- src/main.zig | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 13ceb23..508ab7d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -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, .{});