1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +00:00

Base+LibCore: Store booleans in human-readable format

Fixes #10640.
This commit is contained in:
Ben Wiederhake 2021-11-04 22:28:05 +01:00 committed by Andreas Kling
parent 3e420b7590
commit f9167c9265
8 changed files with 58 additions and 60 deletions

View file

@ -134,10 +134,8 @@ int ConfigFile::read_num_entry(String const& group, String const& key, int defau
bool ConfigFile::read_bool_entry(String const& group, String const& key, bool default_value) const
{
auto value = read_entry(group, key, default_value ? "1" : "0");
if (value == "1" || value.to_lowercase() == "true")
return 1;
return 0;
auto value = read_entry(group, key, default_value ? "true" : "false");
return value == "1" || value.equals_ignoring_case("true"sv);
}
void ConfigFile::write_entry(String const& group, String const& key, String const& value)
@ -152,7 +150,7 @@ void ConfigFile::write_num_entry(String const& group, String const& key, int val
}
void ConfigFile::write_bool_entry(String const& group, String const& key, bool value)
{
write_entry(group, key, value ? "1" : "0");
write_entry(group, key, value ? "true" : "false");
}
void ConfigFile::write_color_entry(String const& group, String const& key, Color value)
{