diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-07-04 01:38:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-04 01:38:01 +0200 |
commit | c020eea184b84ec9193f2bec5265bd72f4e86d24 (patch) | |
tree | 3b1184fee57c0f0c038030808b8264021523024a /editor | |
parent | 79b0a9ddfc41c5b9fe3bc903cab1001aefcedde2 (diff) | |
parent | 929b98d24b53789b3e3fbbae90aed0fe0e72b409 (diff) |
Merge pull request #40092 from hinlopen/remove-find-last
Remove String::find_last (same as rfind)
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_track_editor.cpp | 4 | ||||
-rw-r--r-- | editor/editor_asset_installer.cpp | 2 | ||||
-rw-r--r-- | editor/editor_feature_profile.cpp | 2 | ||||
-rw-r--r-- | editor/editor_file_dialog.cpp | 4 | ||||
-rw-r--r-- | editor/editor_folding.cpp | 2 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 4 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 8 | ||||
-rw-r--r-- | editor/project_manager.cpp | 2 | ||||
-rw-r--r-- | editor/project_settings_editor.cpp | 2 | ||||
-rw-r--r-- | editor/script_create_dialog.cpp | 4 |
11 files changed, 19 insertions, 19 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index f36e84dab6..1d6770a32e 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -3557,7 +3557,7 @@ void AnimationTrackEditor::insert_node_value_key(Node *p_node, const String &p_p if (track_path == np) { value = p_value; //all good } else { - int sep = track_path.find_last(":"); + int sep = track_path.rfind(":"); if (sep != -1) { String base_path = track_path.substr(0, sep); if (base_path == np) { @@ -3656,7 +3656,7 @@ void AnimationTrackEditor::insert_value_key(const String &p_property, const Vari value = p_value; //all good } else { String tpath = animation->track_get_path(i); - int index = tpath.find_last(":"); + int index = tpath.rfind(":"); if (NodePath(tpath.substr(0, index + 1)) == np) { String subindex = tpath.substr(index + 1, tpath.length() - index); value = p_value.get(subindex); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index b43ee0e245..edb299bb90 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -159,7 +159,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { isdir = true; } - int pp = path.find_last("/"); + int pp = path.rfind("/"); TreeItem *parent; if (pp == -1) { diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 2a410c03e7..0d349eb247 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -335,7 +335,7 @@ void EditorFeatureProfileManager::_update_profile_list(const String &p_select_pr } if (!d->current_is_dir()) { - int last_pos = f.find_last(".profile"); + int last_pos = f.rfind(".profile"); if (last_pos != -1) { profiles.push_back(f.substr(0, last_pos)); } diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index 663f3dd856..eb4c587122 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -936,7 +936,7 @@ void EditorFileDialog::set_current_file(const String &p_file) { file->set_text(p_file); update_dir(); invalidate(); - int lp = p_file.find_last("."); + int lp = p_file.rfind("."); if (lp != -1) { file->select(0, lp); file->grab_focus(); @@ -951,7 +951,7 @@ void EditorFileDialog::set_current_path(const String &p_path) { if (!p_path.size()) { return; } - int pos = MAX(p_path.find_last("/"), p_path.find_last("\\")); + int pos = MAX(p_path.rfind("/"), p_path.rfind("\\")); if (pos == -1) { set_current_file(p_path); } else { diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp index f0e6e3a799..a7e76e9b2b 100644 --- a/editor/editor_folding.cpp +++ b/editor/editor_folding.cpp @@ -251,7 +251,7 @@ void EditorFolding::_do_object_unfolds(Object *p_object, Set<RES> &resources) { } } } else { //path - int last = E->get().name.find_last("/"); + int last = E->get().name.rfind("/"); if (last != -1) { bool can_revert = EditorPropertyRevert::can_property_revert(p_object, E->get().name); if (can_revert) { diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index cc58a0d5a0..7742382048 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1664,7 +1664,7 @@ void EditorInspector::update_tree() { basename = group + "/" + basename; } - String name = (basename.find("/") != -1) ? basename.right(basename.find_last("/") + 1) : basename; + String name = (basename.find("/") != -1) ? basename.right(basename.rfind("/") + 1) : basename; if (capitalize_paths) { int dot = name.find("."); @@ -1679,7 +1679,7 @@ void EditorInspector::update_tree() { } } - String path = basename.left(basename.find_last("/")); + String path = basename.left(basename.rfind("/")); if (use_filter && filter != "") { String cat = path; diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 133aa39cd3..4f37fcf39c 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1688,7 +1688,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected String name = to_rename.path.get_file(); rename_dialog->set_title(TTR("Renaming file:") + " " + name); rename_dialog_text->set_text(name); - rename_dialog_text->select(0, name.find_last(".")); + rename_dialog_text->select(0, name.rfind(".")); } else { String name = to_rename.path.substr(0, to_rename.path.length() - 1).get_file(); rename_dialog->set_title(TTR("Renaming folder:") + " " + name); @@ -1732,7 +1732,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected String name = to_duplicate.path.get_file(); duplicate_dialog->set_title(TTR("Duplicating file:") + " " + name); duplicate_dialog_text->set_text(name); - duplicate_dialog_text->select(0, name.find_last(".")); + duplicate_dialog_text->select(0, name.rfind(".")); } else { String name = to_duplicate.path.substr(0, to_duplicate.path.length() - 1).get_file(); duplicate_dialog->set_title(TTR("Duplicating folder:") + " " + name); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 035526ca55..1312f59a70 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -710,11 +710,11 @@ void AnimationPlayerEditor::_dialog_action(String p_file) { Ref<Resource> res = ResourceLoader::load(p_file, "Animation"); ERR_FAIL_COND_MSG(res.is_null(), "Cannot load Animation from file '" + p_file + "'."); ERR_FAIL_COND_MSG(!res->is_class("Animation"), "Loaded resource from file '" + p_file + "' is not Animation."); - if (p_file.find_last("/") != -1) { - p_file = p_file.substr(p_file.find_last("/") + 1, p_file.length()); + if (p_file.rfind("/") != -1) { + p_file = p_file.substr(p_file.rfind("/") + 1, p_file.length()); } - if (p_file.find_last("\\") != -1) { - p_file = p_file.substr(p_file.find_last("\\") + 1, p_file.length()); + if (p_file.rfind("\\") != -1) { + p_file = p_file.substr(p_file.rfind("\\") + 1, p_file.length()); } if (p_file.find(".") != -1) { diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index a800f9e8eb..325d7c5ce6 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -294,7 +294,7 @@ private: // If the project name is empty or default, infer the project name from the selected folder name if (project_name->get_text() == "" || project_name->get_text() == TTR("New Game Project")) { sp = sp.replace("\\", "/"); - int lidx = sp.find_last("/"); + int lidx = sp.rfind("/"); if (lidx != -1) { sp = sp.substr(lidx + 1, sp.length()).capitalize(); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 389b53133e..f84845179b 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -1737,7 +1737,7 @@ void ProjectSettingsEditor::_update_translations() { PackedStringArray selected = remaps[keys[i]]; for (int j = 0; j < selected.size(); j++) { String s2 = selected[j]; - int qp = s2.find_last(":"); + int qp = s2.rfind(":"); String path = s2.substr(0, qp); String locale = s2.substr(qp + 1, s2.length()); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index ae5229b628..40e0582046 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -78,7 +78,7 @@ void ScriptCreateDialog::_notification(int p_what) { void ScriptCreateDialog::_path_hbox_sorted() { if (is_visible()) { - int filename_start_pos = initial_bp.find_last("/") + 1; + int filename_start_pos = initial_bp.rfind("/") + 1; int filename_end_pos = initial_bp.length(); if (!is_built_in) { @@ -553,7 +553,7 @@ void ScriptCreateDialog::_file_selected(const String &p_file) { _path_changed(p); String filename = p.get_file().get_basename(); - int select_start = p.find_last(filename); + int select_start = p.rfind(filename); file_path->select(select_start, select_start + filename.length()); file_path->set_cursor_position(select_start + filename.length()); file_path->grab_focus(); |