mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-09 15:19:13 +02:00
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
This commit is contained in:
parent
ba9f32b652
commit
d3e6dd4814
1 changed files with 7 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue