diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-27 13:34:35 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-27 13:34:35 +0100 |
commit | 7cf1ec1cd42b72bf7c07ca855edd37e17f82805a (patch) | |
tree | dbb85b96d69cfa41e3d8f6fd6e8b9091bfa6b4a4 /editor/project_converter_3_to_4.cpp | |
parent | 6eb25f238fec3f4a104e60f6085ce74462d23ca6 (diff) |
Add 3-to-4 renames for project settings in project.godot
In the ConfigFile format, the first subpath is the category and is not part
of the line that the regex would match.
Fixes #66125.
Diffstat (limited to 'editor/project_converter_3_to_4.cpp')
-rw-r--r-- | editor/project_converter_3_to_4.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index b7c01c061f..3c6f5c0955 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -153,6 +153,7 @@ public: LocalVector<RegEx *> enum_regexes; LocalVector<RegEx *> gdscript_function_regexes; LocalVector<RegEx *> project_settings_regexes; + LocalVector<RegEx *> project_godot_regexes; LocalVector<RegEx *> input_map_regexes; LocalVector<RegEx *> gdscript_properties_regexes; LocalVector<RegEx *> gdscript_signals_regexes; @@ -173,10 +174,14 @@ public: for (unsigned int current_index = 0; RenamesMap3To4::gdscript_function_renames[current_index][0]; current_index++) { gdscript_function_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::gdscript_function_renames[current_index][0] + "\\b"))); } - // Project Settings. + // Project Settings in scripts. for (unsigned int current_index = 0; RenamesMap3To4::project_settings_renames[current_index][0]; current_index++) { project_settings_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::project_settings_renames[current_index][0] + "\\b"))); } + // Project Settings in project.godot. + for (unsigned int current_index = 0; RenamesMap3To4::project_godot_renames[current_index][0]; current_index++) { + project_godot_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::project_godot_renames[current_index][0] + "\\b"))); + } // Input Map. for (unsigned int current_index = 0; RenamesMap3To4::input_map_renames[current_index][0]; current_index++) { input_map_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::input_map_renames[current_index][0] + "\\b"))); @@ -253,6 +258,9 @@ public: for (RegEx *regex : project_settings_regexes) { memdelete(regex); } + for (RegEx *regex : project_godot_regexes) { + memdelete(regex); + } for (RegEx *regex : input_map_regexes) { memdelete(regex); } @@ -405,7 +413,7 @@ bool ProjectConverter3To4::convert() { custom_rename(lines, "\\.shader", ".gdshader"); } else if (file_name.ends_with("project.godot")) { - rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines); + rename_common(RenamesMap3To4::project_godot_renames, reg_container.project_godot_regexes, lines); rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines); rename_common(RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, lines); } else if (file_name.ends_with(".csproj")) { @@ -577,7 +585,7 @@ bool ProjectConverter3To4::validate_conversion() { changed_elements.append_array(check_for_custom_rename(lines, "\\.shader", ".gdshader")); } else if (file_name.ends_with("project.godot")) { - changed_elements.append_array(check_for_rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::project_godot_renames, reg_container.project_godot_regexes, lines)); changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines)); changed_elements.append_array(check_for_rename_common(RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, lines)); } else if (file_name.ends_with(".csproj")) { @@ -1106,6 +1114,7 @@ bool ProjectConverter3To4::test_array_names() { valid = valid && test_single_array(RenamesMap3To4::shaders_renames, true); valid = valid && test_single_array(RenamesMap3To4::gdscript_signals_renames); valid = valid && test_single_array(RenamesMap3To4::project_settings_renames); + valid = valid && test_single_array(RenamesMap3To4::project_godot_renames); valid = valid && test_single_array(RenamesMap3To4::input_map_renames); valid = valid && test_single_array(RenamesMap3To4::builtin_types_renames); valid = valid && test_single_array(RenamesMap3To4::color_renames); |