From d3e6dd481462ce8190f356df0b921a72b49e95bd Mon Sep 17 00:00:00 2001 From: Titanium Brain Date: Sat, 11 Jul 2026 09:54:36 +0100 Subject: [PATCH] feat(main): check for Lua config and fallback to INI Checks for the presence of a config.lua file. If it fails to find it or read it, default to config.ini --- src/main.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.zig b/src/main.zig index 3f18bbe..0b8ed0b 100644 --- a/src/main.zig +++ b/src/main.zig @@ -237,8 +237,13 @@ pub fn main(init: std.process.Init) !void { state.allocator.free(state.old_save_path); }; - // TODO do not hardcode config file name - const config_path = try std.Io.Dir.path.join(state.allocator, &[_][]const u8{ config_parent_path, "config.lua" }); + // Test for presence of Lua config file first + // If it fails, fall back to ini + var config_path = try std.Io.Dir.path.join(state.allocator, &[_][]const u8{ config_parent_path, "config.lua" }); + if (std.Io.Dir.accessAbsolute(state.io, config_path, .{})) |_| {} else |_| { + state.allocator.free(config_path); + config_path = try std.Io.Dir.path.join(state.allocator, &[_][]const u8{ config_parent_path, "config.ini" }); + } defer state.allocator.free(config_path); custom.binds = .empty;