unify configuration path resolution between dev and prod (use zig build run -- --path "config/config.toml")

This commit is contained in:
2026-08-04 13:17:00 +02:00
parent 7c97ad554e
commit 2a6ade9bf7

View File

@@ -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);