turns out passing in the -u flag didn't actually work before...

Additionally, in the case that the directory doesn't exist mezzaluna
will default back to the config at ~/.config/mez/
This commit is contained in:
Squibid 2026-03-05 09:30:01 -05:00
parent fd997e8219
commit f60a2c5c37
3 changed files with 34 additions and 46 deletions

View file

@ -54,9 +54,15 @@ pub fn main() !void {
var lua_config: Lua.Config = .{ .enabled = true, .path = null };
if (res.args.u != null and res.args.clean == 1) {
std.debug.panic("You cannot set both -u and --clean", .{});
} else if (res.args.u != null) {
} else if (res.args.u != null) blk: {
// this is freed in lua/lua.zig
const path = try std.fs.cwd().realpathAlloc(gpa, res.args.u.?);
const path = std.fs.cwd().realpathAlloc(gpa, res.args.u.?) catch |err| switch (err) {
error.FileNotFound => {
std.log.err("Path {s} does not exist, and therefore won't be used for the configuration.", .{ res.args.u.? });
break :blk;
},
else => return err,
};
lua_config.path = path;
} else if (res.args.clean == 1) {
lua_config.enabled = false;