[Windows] Add support for handling network share paths.

This commit is contained in:
bruvzg 2022-01-24 13:12:46 +02:00
parent 6a3ff8fa1f
commit cba8280515
8 changed files with 69 additions and 16 deletions

View file

@ -169,7 +169,14 @@ void FileDialog::update_dir() {
dir->set_text(dir_access->get_current_dir(false));
if (drives->is_visible()) {
drives->select(dir_access->get_current_drive());
if (dir_access->get_current_dir().is_network_share_path()) {
_update_drives(false);
drives->add_item(RTR("Network"));
drives->set_item_disabled(drives->get_item_count() - 1, true);
drives->select(drives->get_item_count() - 1);
} else {
drives->select(dir_access->get_current_drive());
}
}
// Deselect any item, to make "Select Current Folder" button text by default.
@ -846,7 +853,7 @@ void FileDialog::_select_drive(int p_idx) {
_push_history();
}
void FileDialog::_update_drives() {
void FileDialog::_update_drives(bool p_select) {
int dc = dir_access->get_drive_count();
if (dc == 0 || access != ACCESS_FILESYSTEM) {
drives->hide();
@ -864,7 +871,9 @@ void FileDialog::_update_drives() {
drives->add_item(dir_access->get_drive(i));
}
drives->select(dir_access->get_current_drive());
if (p_select) {
drives->select(dir_access->get_current_drive());
}
}
}

View file

@ -132,7 +132,7 @@ private:
void _go_back();
void _go_forward();
void _update_drives();
void _update_drives(bool p_select = true);
virtual void unhandled_input(const Ref<InputEvent> &p_event) override;