fix args
This commit is contained in:
parent
710c5b71e5
commit
432151cc40
1 changed files with 7 additions and 1 deletions
|
|
@ -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, .{});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue