mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Remove config.save_file
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
36
src/main.zig
36
src/main.zig
@@ -142,20 +142,10 @@ pub fn main() !void {
|
||||
save_path_alloc = true;
|
||||
|
||||
var user_buf: [32]u8 = undefined;
|
||||
save = save_ini.readFileToStruct(save_path, comment_characters, null) catch migrator.tryMigrateSaveFile(&user_buf, config.save_file);
|
||||
save = save_ini.readFileToStruct(save_path, comment_characters, null) catch migrator.tryMigrateSaveFile(&user_buf);
|
||||
}
|
||||
|
||||
migrator.lateConfigFieldHandler(&config.animation);
|
||||
|
||||
// if (migrator.mapped_config_fields) save_migrated_config: {
|
||||
// var file = try std.fs.cwd().createFile(config_path, .{});
|
||||
// defer file.close();
|
||||
|
||||
// const writer = file.writer();
|
||||
// ini.writeFromStruct(config, writer, null, true, .{}) catch {
|
||||
// break :save_migrated_config;
|
||||
// };
|
||||
// }
|
||||
} else {
|
||||
const config_path = build_options.config_directory ++ "/ly/config.ini";
|
||||
|
||||
@@ -171,22 +161,22 @@ pub fn main() !void {
|
||||
|
||||
if (config.load) {
|
||||
var user_buf: [32]u8 = undefined;
|
||||
save = save_ini.readFileToStruct(save_path, comment_characters, null) catch migrator.tryMigrateSaveFile(&user_buf, config.save_file);
|
||||
save = save_ini.readFileToStruct(save_path, comment_characters, null) catch migrator.tryMigrateSaveFile(&user_buf);
|
||||
}
|
||||
|
||||
migrator.lateConfigFieldHandler(&config.animation);
|
||||
|
||||
// if (migrator.mapped_config_fields) save_migrated_config: {
|
||||
// var file = try std.fs.cwd().createFile(config_path, .{});
|
||||
// defer file.close();
|
||||
|
||||
// const writer = file.writer();
|
||||
// ini.writeFromStruct(config, writer, null, true, .{}) catch {
|
||||
// break :save_migrated_config;
|
||||
// };
|
||||
// }
|
||||
}
|
||||
|
||||
// if (migrator.mapped_config_fields) save_migrated_config: {
|
||||
// var file = try std.fs.cwd().createFile(config_path, .{});
|
||||
// defer file.close();
|
||||
|
||||
// const writer = file.writer();
|
||||
// ini.writeFromStruct(config, writer, null, true, .{}) catch {
|
||||
// break :save_migrated_config;
|
||||
// };
|
||||
// }
|
||||
|
||||
// These strings only end up getting freed if the user quits Ly using Ctrl+C, which is fine since in the other cases
|
||||
// we end up shutting down or restarting the system
|
||||
shutdown_cmd = try temporary_allocator.dupe(u8, config.shutdown_cmd);
|
||||
@@ -669,7 +659,7 @@ pub fn main() !void {
|
||||
ini.writeFromStruct(save_data, file.writer(), null, true, .{}) catch break :save_last_settings;
|
||||
|
||||
// Delete previous save file if it exists
|
||||
std.fs.cwd().deleteFile(config.save_file) catch {};
|
||||
if (migrator.maybe_save_file) |path| std.fs.cwd().deleteFile(path) catch {};
|
||||
}
|
||||
|
||||
var shared_err = try SharedError.init();
|
||||
|
||||
Reference in New Issue
Block a user