diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-07 09:04:44 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-07 09:04:44 +0200 |
commit | e63252b4219680d109bfa41c24f483e97b37f40e (patch) | |
tree | 8b8af6d7efcab9b2692d45dec65449fd83d2c8b9 /editor/filesystem_dock.cpp | |
parent | 570220ba9b127325f1a5aa7bb17d5c6f76ccf62c (diff) | |
parent | 955d5affa857ec1f358c56da8fb1ff4ab6590704 (diff) | |
download | redot-engine-e63252b4219680d109bfa41c24f483e97b37f40e.tar.gz |
Merge pull request #90705 from AThousandShips/foreach_list
Reduce and prevent unnecessary random-access to `List`
Diffstat (limited to 'editor/filesystem_dock.cpp')
-rw-r--r-- | editor/filesystem_dock.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 01d9096db3..ea76c20a0f 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2270,11 +2270,11 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected } const bool is_directory = fpath.ends_with("/"); - for (int i = 0; i < terminal_emulator_args.size(); i++) { + for (String &terminal_emulator_arg : terminal_emulator_args) { if (is_directory) { - terminal_emulator_args[i] = terminal_emulator_args[i].replace("{directory}", ProjectSettings::get_singleton()->globalize_path(fpath)); + terminal_emulator_arg = terminal_emulator_arg.replace("{directory}", ProjectSettings::get_singleton()->globalize_path(fpath)); } else { - terminal_emulator_args[i] = terminal_emulator_args[i].replace("{directory}", ProjectSettings::get_singleton()->globalize_path(fpath).get_base_dir()); + terminal_emulator_arg = terminal_emulator_arg.replace("{directory}", ProjectSettings::get_singleton()->globalize_path(fpath).get_base_dir()); } } @@ -2290,8 +2290,8 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected const Error err = OS::get_singleton()->create_process(chosen_terminal_emulator, terminal_emulator_args, nullptr, true); if (err != OK) { String args_string; - for (int i = 0; i < terminal_emulator_args.size(); i++) { - args_string += terminal_emulator_args[i]; + for (const String &terminal_emulator_arg : terminal_emulator_args) { + args_string += terminal_emulator_arg; } ERR_PRINT_ED(vformat(TTR("Couldn't run external terminal program (error code %d): %s %s\nCheck `filesystem/external_programs/terminal_emulator` and `filesystem/external_programs/terminal_emulator_flags` in the Editor Settings."), err, chosen_terminal_emulator, args_string)); } |