properly force string prefs to be quoted on win/linux
This commit is contained in:
@@ -163,9 +163,9 @@ std::string read_maybe_quoted_string(std::istream& from) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string maybe_quote_string(std::string which) {
|
||||
std::string maybe_quote_string(std::string which, bool force) {
|
||||
if(which.empty()) return "''";
|
||||
if(which.find_first_of(" \t\n\f") != std::string::npos || which[0] == '"' || which[0] == '\'') {
|
||||
if(force || which.find_first_of(" \t\n\f") != 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.
|
||||
int apos = 0, quot = 0, bslash = 0, newline = 0, formfeed = 0;
|
||||
|
@@ -33,7 +33,7 @@ bool save_party(fs::path dest_file, const cUniverse& univ);
|
||||
void init_directories(const char* exec_path);
|
||||
|
||||
std::string read_maybe_quoted_string(std::istream& from);
|
||||
std::string maybe_quote_string(std::string which);
|
||||
std::string maybe_quote_string(std::string which, bool force = false);
|
||||
|
||||
template<typename T>
|
||||
struct array_value_type{
|
||||
|
Reference in New Issue
Block a user