1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

Replace String::find_last with rfind where possible (backward compatible with old API)

This commit is contained in:
Bartłomiej T. Listwon
2022-01-08 22:40:44 +01:00
parent 37b9aba458
commit 22750b1c03
18 changed files with 35 additions and 43 deletions

View File

@@ -722,11 +722,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) {