From f0ae69ed8e04c65a7960c4d67d94c2d0707fddd7 Mon Sep 17 00:00:00 2001 From: Marius Hanl Date: Sun, 2 Feb 2025 20:59:07 +0100 Subject: [PATCH] Fix 'Show in FileSystem' jumps to incorrect entry under certain conditions --- editor/filesystem_dock.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index b1156f61a3d..bc236c121f5 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -746,7 +746,8 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa // Select the file or directory in the tree. tree->deselect_all(); if (display_mode == DISPLAY_MODE_TREE_ONLY) { - const String file_name = is_directory ? target_path.trim_suffix("/").get_file() + "/" : target_path.get_file(); + // Either search for 'folder/' or '/file.ext'. + const String file_name = is_directory ? target_path.trim_suffix("/").get_file() + "/" : "/" + target_path.get_file(); TreeItem *item = is_directory ? *directory_ptr : (*directory_ptr)->get_first_child(); while (item) { if (item->get_metadata(0).operator String().ends_with(file_name)) {