diff --git a/src/config/migrator.zig b/src/config/migrator.zig index fc25768..9c3fc10 100644 --- a/src/config/migrator.zig +++ b/src/config/migrator.zig @@ -74,16 +74,27 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie } if (std.mem.eql(u8, field.key, "animation")) { - // The option now uses a string (which then gets converted into an enum) instead of an integer - // It also combines the previous "animate" and "animation" options - const animation = std.fmt.parseInt(u8, field.value, 10) catch return field; + string_conversion: { + // The option now uses a string (which then gets converted into an enum) instead of an integer + // It also combines the previous "animate" and "animation" options + const animation = std.fmt.parseInt(u8, field.value, 10) catch break :string_conversion; + var mapped_field = field; + + mapped_field.value = switch (animation) { + 0 => "doom", + 1 => "matrix", + else => "none", + }; + + return mapped_field; + } + + // 'dur_file' was renamed to 'dur' var mapped_field = field; - mapped_field.value = switch (animation) { - 0 => "doom", - 1 => "matrix", - else => "none", - }; + if (std.mem.eql(u8, mapped_field.value, "dur_file")) { + mapped_field.value = "dur"; + } return mapped_field; } diff --git a/src/enums.zig b/src/enums.zig index ff69f84..5208f09 100644 --- a/src/enums.zig +++ b/src/enums.zig @@ -6,7 +6,7 @@ pub const Animation = enum { matrix, colormix, gameoflife, - dur_file, + dur, lua, }; diff --git a/src/main.zig b/src/main.zig index 9508c41..811ca25 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1086,7 +1086,7 @@ pub fn main(init: std.process.Init) !void { ); animation = game_of_life.widget(); }, - .dur_file => { + .dur => { var dur = try DurFile.init( state.allocator, state.io,