Skip to content

Commit a78df19

Browse files
committed
Fix double quotes
1 parent 235347c commit a78df19

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/xtd.core/src/xtd/configuration/file_settings.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ void file_settings::from_string(const xtd::ustring& text) {
9494
else {
9595
auto value = remove_comment(ustring::join("=", key_value, 1));
9696
if (value.starts_with('"') && value.ends_with('"')) value = value.trim('"');
97+
if (value.starts_with('\'') && value.ends_with('\'')) value = value.trim('\'');
9798
section_key_values_[section][unescaping(key_value[0].trim().trim('"'))] = unescaping(value);
9899
}
99100
}
@@ -163,7 +164,7 @@ ustring file_settings::to_string() const noexcept {
163164
for (auto [section, key_value] : section_key_values_) {
164165
if (!ustring::is_empty(section)) text += ustring::format("{}[{}]\n", text.size() == 0 ? "" : "\n", section);
165166
for (auto [key, value] : key_value)
166-
text += ustring::format("{}={}\n", key, value.starts_with(' ') || value.starts_with('\t') || value.ends_with(' ') || value.ends_with('\t') || value.contains("#") ? ustring::format("\"{}\"", value) : value);
167+
text += ustring::format("{}={}\n", key, value.starts_with(' ') || value.starts_with('\t') || value.ends_with(' ') || value.ends_with('\t') || value.contains("#") || value.contains(";") || value.contains("=") ? ustring::format("\"{}\"", value) : value);
167168
}
168169
return text;
169170
}

0 commit comments

Comments
 (0)