Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'Show in FileSystem' jumps to incorrect entry under certain conditions #102336

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down