From adba8b1bde96801662ba97dfd5500c48ba1a33e7 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Sun, 24 Nov 2024 23:49:46 +0200 Subject: [PATCH] [Windows] Fix root and current folder in native file dialog. --- editor/gui/editor_file_dialog.cpp | 10 +++++++--- editor/gui/editor_file_dialog.h | 1 + platform/windows/display_server_windows.cpp | 5 +---- scene/gui/file_dialog.cpp | 17 +++++++++++------ scene/gui/file_dialog.h | 1 + 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index 03816098047c..d63f9af12ebc 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -117,6 +117,12 @@ void EditorFileDialog::_native_dialog_cb(bool p_ok, const Vector &p_file selected_options = p_selected_options; String f = files[0]; + + filter->select(p_filter); + dir->set_text(f.get_base_dir()); + file->set_text(f.get_file()); + _dir_submitted(f.get_base_dir()); + if (mode == FILE_MODE_OPEN_FILES) { emit_signal(SNAME("files_selected"), files); } else { @@ -145,9 +151,6 @@ void EditorFileDialog::_native_dialog_cb(bool p_ok, const Vector &p_file emit_signal(SNAME("dir_selected"), f); } } - file->set_text(f); - dir->set_text(f.get_base_dir()); - filter->select(p_filter); } void EditorFileDialog::popup_file_dialog() { @@ -363,6 +366,7 @@ Vector EditorFileDialog::get_selected_files() const { } void EditorFileDialog::update_dir() { + full_dir = dir_access->get_current_dir(); if (drives->is_visible()) { if (dir_access->get_current_dir().is_network_share_path()) { _update_drives(false); diff --git a/editor/gui/editor_file_dialog.h b/editor/gui/editor_file_dialog.h index 7a928a6188b9..69bb4e2e98e2 100644 --- a/editor/gui/editor_file_dialog.h +++ b/editor/gui/editor_file_dialog.h @@ -203,6 +203,7 @@ class EditorFileDialog : public ConfirmationDialog { Vector