mirror of https://github.com/fairyglade/ly.git
Clean up save code
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
aa00f7c8c7
commit
a801d1a569
|
|
@ -235,11 +235,7 @@ pub fn main(init: std.process.Init) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load configuration file
|
// Load configuration file
|
||||||
var save_path_alloc = false;
|
defer if (state.config.save) {
|
||||||
|
|
||||||
state.save_path = build_options.config_directory ++ "/ly/save.txt";
|
|
||||||
state.old_save_path = build_options.config_directory ++ "/ly/save.ini";
|
|
||||||
defer if (save_path_alloc) {
|
|
||||||
state.allocator.free(state.save_path);
|
state.allocator.free(state.save_path);
|
||||||
state.allocator.free(state.old_save_path);
|
state.allocator.free(state.old_save_path);
|
||||||
};
|
};
|
||||||
|
|
@ -284,7 +280,6 @@ pub fn main(init: std.process.Init) !void {
|
||||||
if (state.config.save) {
|
if (state.config.save) {
|
||||||
state.save_path = try std.Io.Dir.path.join(state.allocator, &[_][]const u8{ config_parent_path, "save.txt" });
|
state.save_path = try std.Io.Dir.path.join(state.allocator, &[_][]const u8{ config_parent_path, "save.txt" });
|
||||||
state.old_save_path = try std.Io.Dir.path.join(state.allocator, &[_][]const u8{ config_parent_path, "save.ini" });
|
state.old_save_path = try std.Io.Dir.path.join(state.allocator, &[_][]const u8{ config_parent_path, "save.ini" });
|
||||||
save_path_alloc = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config_parser.maybe_load_error == null) {
|
if (config_parser.maybe_load_error == null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue