properly force string prefs to be quoted on win/linux

This commit is contained in:
2025-01-14 16:21:26 -06:00
committed by Celtic Minstrel
parent aa58b3cb41
commit 80aa0341a1
3 changed files with 4 additions and 7 deletions

View File

@@ -106,10 +106,7 @@ static bool save_prefs(fs::path fpath) {
fout << kv.first << " = " << std::fixed << boost::any_cast<double>(kv.second) << std::endl;
else if(kv.second.type() == typeid(std::string)){
std::string value = boost::any_cast<std::string>(kv.second);
// Surround with quotes so maybe_quote_string() will always quote it
value.insert(0, 1, '"');
value.push_back('"');
fout << kv.first << " = " << maybe_quote_string(value) << std::endl;
fout << kv.first << " = " << maybe_quote_string(value, true) << std::endl;
}else printf("Warning: Unknown preference value type, skipping...\n");
if(!fout) {
perror("Error writing preferences");