Browse Source

settings: parse bool as string

mcspr-patch-1
Maxim Prokhorov 3 years ago
parent
commit
9eb39bfd86
1 changed files with 17 additions and 1 deletions
  1. +17
    -1
      code/espurna/settings.cpp

+ 17
- 1
code/espurna/settings.cpp View File

@ -87,7 +87,23 @@ long convert(const String& value) {
template <> template <>
bool convert(const String& value) { bool convert(const String& value) {
return convert<int>(value) == 1;
if (value.length()) {
if ((value == "0")
|| (value == "n")
|| (value == "no")
|| (value == "false")
|| (value == "off")) {
return false;
}
return (value == "1")
|| (value == "y")
|| (value == "yes")
|| (value == "true")
|| (value == "on");
}
return false;
} }
template <> template <>


Loading…
Cancel
Save