diff --git a/editor/settings/editor_settings.cpp b/editor/settings/editor_settings.cpp index 5e2143402d3..4ab88e4abdc 100644 --- a/editor/settings/editor_settings.cpp +++ b/editor/settings/editor_settings.cpp @@ -1174,18 +1174,14 @@ void EditorSettings::_load_default_visual_shader_editor_theme() { } String EditorSettings::_guess_exec_args_for_extenal_editor(const String &p_path) { - Ref regex; - regex.instantiate(); - - const String editor_pattern = R"([\\/]((?:jetbrains\s*)?rider(?:\s*(eap|\d{4}\.\d+|\d{4}\.\d+\s*dev)?)?|visual\s*studio\s*code|subl(ime\s*text)?|sublime_text|(g)?vim|emacs|atom|geany|kate|code|(vs)?codium)(?:\.app|\.exe|\.bat|\.sh)?)"; - regex->compile(editor_pattern); - Ref editor_match = regex->search(p_path.to_lower()); + Ref regex = RegEx::create_from_string(R"((?:jetbrains\s*)?rider(?:\s*(eap|\d{4}\.\d+|\d{4}\.\d+\s*dev)?)?|visual\s*studio\s*code|subl(ime\s*text)?|sublime_text|(g)?vim|emacs|atom|geany|kate|code|(vs)?codium)"); + Ref editor_match = regex->search(p_path.to_lower().get_file().get_basename()); if (editor_match.is_null()) { return String(); } - const String editor = editor_match->get_string(1).to_lower(); + const String editor = editor_match->get_string(0).to_lower(); String new_exec_flags = "{file}"; if (editor.begins_with("rider")) {