summaryrefslogtreecommitdiff
path: root/core/io/config_file.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2023-01-12 21:53:15 +0100
committerGitHub <noreply@github.com>2023-01-12 21:53:15 +0100
commitc2790ec2b9ef737e7bcc203d7f7e6faf31e95862 (patch)
tree115d0378371de8c02451561d86e8a335665577c8 /core/io/config_file.cpp
parent886f7f8290738775db3a64f59d0a613465af64db (diff)
parent0d122ce45998b33e923ac406129f64b5e9f3affb (diff)
Merge pull request #68450 from KoBeWi/bracket_escapist
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 f2cd3ba4d9..98f8c3de41 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("\\]", "]");
}
}