mirror of
https://github.com/fairyglade/ly.git
synced 2026-06-22 07:22:00 +00:00
Clean up save code
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user