summaryrefslogtreecommitdiff
path: root/core/io/config_file.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-11-09 14:00:51 +0100
committerkobewi <kobewi4e@gmail.com>2022-11-09 14:00:51 +0100
commit0d122ce45998b33e923ac406129f64b5e9f3affb (patch)
tree160a4a71354f8fc20194338dc06b45ff60bad8a3 /core/io/config_file.cpp
parent29de658c2908b6b50b218225539f9779292eb870 (diff)
Allow to escape closing brackets in CFG tags
Diffstat (limited to 'core/io/config_file.cpp')
-rw-r--r--core/io/config_file.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index f84a95347a..604cf67c1d 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -208,7 +208,7 @@ Error ConfigFile::_internal_save(Ref<FileAccess> file) {
file->store_string("\n");
}
if (!E.key.is_empty()) {
- file->store_string("[" + E.key + "]\n\n");
+ file->store_string("[" + E.key.replace("]", "\\]") + "]\n\n");
}
for (const KeyValue<String, Variant> &F : E.value) {
@@ -308,7 +308,7 @@ Error ConfigFile::_parse(const String &p_path, VariantParser::Stream *p_stream)
if (!assign.is_empty()) {
set_value(section, assign, value);
} else if (!next_tag.name.is_empty()) {
- section = next_tag.name;
+ section = next_tag.name.replace("\\]", "]");
}
}