unify configuration path resolution between dev and prod (use zig build run -- --path "config/config.toml")
This commit is contained in:
17
src/main.zig
17
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);
|
||||
|
||||
Reference in New Issue
Block a user