From 2a6ade9bf73a50c4cf1f6cb1a248b3998d623d6b Mon Sep 17 00:00:00 2001 From: Overlord Date: Tue, 4 Aug 2026 13:17:00 +0200 Subject: [PATCH] unify configuration path resolution between dev and prod (use `zig build run -- --path "config/config.toml"`) --- src/main.zig | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main.zig b/src/main.zig index 43744f4..36ec6c5 100644 --- a/src/main.zig +++ b/src/main.zig @@ -46,20 +46,13 @@ pub fn main(init: std.process.Init) !void var result = try parser.parseProcess(init); - const path = if (debug) path: - { - const tmp_path = result.getString("path") orelse "config/config.toml"; - break :path try allocator.dupe(u8, tmp_path); - } - else path: - { - const tmp_path = result.getString("path") orelse blk: { - const exe = try std.process.executableDirPathAlloc(io, tmp_allocator); - break :blk try std.Io.Dir.path.join(tmp_allocator, &.{ exe, "config/config.toml" }); - }; - break :path try allocator.dupe(u8, tmp_path); + const tmp_path = result.getString("path") orelse path: { + const exe = try std.process.executableDirPathAlloc(io, tmp_allocator); + break :path try std.Io.Dir.path.join(tmp_allocator, &.{ exe, "config/config.toml" }); }; + const path = try allocator.dupe(u8, tmp_path); + _ = zocket.memory.deinitIfExists(&tmp_arena); try run(io, allocator, path);