Skip to content

Commit

Permalink
Allow values quoting in config files
Browse files Browse the repository at this point in the history
The config file values can be surrounded by quotation marks. This allows
for explicit using of whitespaces (e.g. in paths).
  • Loading branch information
hebasto committed Oct 8, 2018
1 parent 1e8f88e commit 7bc6de6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,9 @@ static bool GetConfigOptions(std::istream& stream, std::string& error, std::vect
} else if ((pos = str.find('=')) != std::string::npos) {
std::string name = prefix + TrimString(str.substr(0, pos), pattern);
std::string value = TrimString(str.substr(pos + 1), pattern);
if (*value.begin() == '"' && *value.rbegin() == '"') {
value = value.substr(1, value.size() - 2);
}
options.emplace_back(name, value);
} else {
error = strprintf("parse error on line %i: %s", linenr, str);
Expand Down

0 comments on commit 7bc6de6

Please sign in to comment.