You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using FileDialog with FILE_MODE_OPEN_ANY mode, print selected files. If I select a file first, then select a dir in the same dir, then click Open, this editor return the path of the file, not the dir.
After checking the code, I think this is because when I select a file, FileDialog::_tree_selected set select file name into file
voidFileDialog::_tree_selected() {
TreeItem *ti = tree->get_selected();
if (!ti) {
return;
}
Dictionary d = ti->get_metadata(0);
if (!d["dir"]) {
file->set_text(d["name"]);
} elseif (mode == FILE_MODE_OPEN_DIR) {
set_ok_button_text(ETR("Select This Folder"));
}
get_ok_button()->set_disabled(_is_open_should_be_disabled());
}
then in FileDialog::_action_pressed, file->get_text() return a exist file, cause select dir is ignored.
Tested versions
v4.3.stable.official [77dcf97]
System information
Godot v4.3.stable - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce MX250 (NVIDIA; 31.0.15.3209) - Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz (8 Threads)
Issue description
using FileDialog with
FILE_MODE_OPEN_ANY
mode, print selected files. If I select a file first, then select a dir in the same dir, then clickOpen
, this editor return the path of the file, not the dir.After checking the code, I think this is because when I select a file,
FileDialog::_tree_selected
set select file name intofile
then in
FileDialog::_action_pressed
,file->get_text()
return a exist file, cause select dir is ignored.Steps to reproduce
using FileDialog with
FILE_MODE_OPEN_ANY
modeselect a file first
then select a dir in the same dir
click
Open
Minimal reproduction project (MRP)
MRP.zip
The text was updated successfully, but these errors were encountered: