Fix appending to Setting<StringSet>

Fixes: warning: unknown setting 'extra-sandbox-paths'
This commit is contained in:
Eelco Dolstra 2020-11-09 15:04:34 +01:00
parent 387f824cab
commit b87f84cf55
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -291,7 +291,14 @@ template<> std::string BaseSetting<Strings>::to_string() const
template<> void BaseSetting<StringSet>::set(const std::string & str, bool append) template<> void BaseSetting<StringSet>::set(const std::string & str, bool append)
{ {
value = tokenizeString<StringSet>(str); if (!append) value.clear();
for (auto & s : tokenizeString<StringSet>(str))
value.insert(s);
}
template<> bool BaseSetting<StringSet>::isAppendable()
{
return true;
} }
template<> std::string BaseSetting<StringSet>::to_string() const template<> std::string BaseSetting<StringSet>::to_string() const
@ -302,9 +309,7 @@ template<> std::string BaseSetting<StringSet>::to_string() const
template<> void BaseSetting<StringMap>::set(const std::string & str, bool append) template<> void BaseSetting<StringMap>::set(const std::string & str, bool append)
{ {
if (!append) value.clear(); if (!append) value.clear();
auto kvpairs = tokenizeString<Strings>(str); for (auto & s : tokenizeString<Strings>(str)) {
for (auto & s : kvpairs)
{
auto eq = s.find_first_of('='); auto eq = s.find_first_of('=');
if (std::string::npos != eq) if (std::string::npos != eq)
value.emplace(std::string(s, 0, eq), std::string(s, eq + 1)); value.emplace(std::string(s, 0, eq), std::string(s, eq + 1));