maybe_quote_string now quotes the empty string

This commit is contained in:
2023-01-15 20:38:51 -05:00
parent 657df9ea8d
commit 40db245011

View File

@@ -150,6 +150,7 @@ std::string read_maybe_quoted_string(std::istream& from) {
}
std::string maybe_quote_string(std::string which) {
if(which.empty()) return "''";
if(which.find_first_of(' ') != std::string::npos || which[0] == '"' || which[0] == '\'') {
// The string contains spaces or starts with a quote, so quote it.
// We may have to escape quotes or backslashes.