mirror of https://github.com/fairyglade/ly.git
Update config migrator
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
69d39dc035
commit
aa0222948a
|
@ -37,6 +37,7 @@ const removed_properties = [_][]const u8{
|
||||||
"x_cmd_setup",
|
"x_cmd_setup",
|
||||||
"wayland_cmd",
|
"wayland_cmd",
|
||||||
"console_dev",
|
"console_dev",
|
||||||
|
"load",
|
||||||
};
|
};
|
||||||
|
|
||||||
var temporary_allocator = std.heap.page_allocator;
|
var temporary_allocator = std.heap.page_allocator;
|
||||||
|
@ -46,14 +47,11 @@ pub var auto_eight_colors: bool = true;
|
||||||
pub var maybe_animate: ?bool = null;
|
pub var maybe_animate: ?bool = null;
|
||||||
pub var maybe_save_file: ?[]const u8 = null;
|
pub var maybe_save_file: ?[]const u8 = null;
|
||||||
|
|
||||||
pub var mapped_config_fields = false;
|
|
||||||
|
|
||||||
pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniField {
|
pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniField {
|
||||||
if (std.mem.eql(u8, field.key, "animate")) {
|
if (std.mem.eql(u8, field.key, "animate")) {
|
||||||
// The option doesn't exist anymore, but we save its value for "animation"
|
// The option doesn't exist anymore, but we save its value for "animation"
|
||||||
maybe_animate = std.mem.eql(u8, field.value, "true");
|
maybe_animate = std.mem.eql(u8, field.value, "true");
|
||||||
|
|
||||||
mapped_config_fields = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +67,6 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
|
||||||
else => "none",
|
else => "none",
|
||||||
};
|
};
|
||||||
|
|
||||||
mapped_config_fields = true;
|
|
||||||
return mapped_field;
|
return mapped_field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +98,6 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
|
||||||
var mapped_field = field;
|
var mapped_field = field;
|
||||||
mapped_field.key = "clear_password";
|
mapped_field.key = "clear_password";
|
||||||
|
|
||||||
mapped_config_fields = true;
|
|
||||||
return mapped_field;
|
return mapped_field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +113,6 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
|
||||||
else => "login",
|
else => "login",
|
||||||
};
|
};
|
||||||
|
|
||||||
mapped_config_fields = true;
|
|
||||||
return mapped_field;
|
return mapped_field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,14 +120,12 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
|
||||||
// The option doesn't exist anymore, but we save its value for migration later on
|
// The option doesn't exist anymore, but we save its value for migration later on
|
||||||
maybe_save_file = temporary_allocator.dupe(u8, field.value) catch return null;
|
maybe_save_file = temporary_allocator.dupe(u8, field.value) catch return null;
|
||||||
|
|
||||||
mapped_config_fields = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline for (removed_properties) |property| {
|
inline for (removed_properties) |property| {
|
||||||
if (std.mem.eql(u8, field.key, property)) {
|
if (std.mem.eql(u8, field.key, property)) {
|
||||||
// The options don't exist anymore
|
// The options don't exist anymore
|
||||||
mapped_config_fields = true;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,10 +137,8 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
|
||||||
|
|
||||||
if (std.mem.eql(u8, field.value, "true")) {
|
if (std.mem.eql(u8, field.value, "true")) {
|
||||||
mapped_field.value = "en";
|
mapped_field.value = "en";
|
||||||
mapped_config_fields = true;
|
|
||||||
} else if (std.mem.eql(u8, field.value, "false")) {
|
} else if (std.mem.eql(u8, field.value, "false")) {
|
||||||
mapped_field.value = "none";
|
mapped_field.value = "none";
|
||||||
mapped_config_fields = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapped_field;
|
return mapped_field;
|
||||||
|
|
Loading…
Reference in New Issue