mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
LibCore: read_bool_entry parse "true" / "false" strings in config files
`read_bool_entry()` can now interpret both integers (1 or 0) and
Boolean strings ("true" or "false") in configuration files.
All values other than "1" or "true" are considered false.
This commit is contained in:
committed by
Andreas Kling
parent
7540203ae8
commit
edd8abc4cf
@@ -138,7 +138,10 @@ int ConfigFile::read_num_entry(const String& group, const String& key, int defau
|
||||
|
||||
bool ConfigFile::read_bool_entry(const String& group, const String& key, bool default_value) const
|
||||
{
|
||||
return read_entry(group, key, default_value ? "1" : "0") == "1";
|
||||
auto value = read_entry(group, key, default_value ? "1" : "0");
|
||||
if (value == "1" || value.to_lowercase() == "true")
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ConfigFile::write_entry(const String& group, const String& key, const String& value)
|
||||
|
||||
Reference in New Issue
Block a user