diff options
author | Ying-Ruei Liang(KK) <thumbd03803@gmail.com> | 2016-09-26 15:43:10 +0800 |
---|---|---|
committer | Ying-Ruei Liang(KK) <thumbd03803@gmail.com> | 2016-09-26 16:05:22 +0800 |
commit | b40265492cccb9ee11067e328bd6e7f828fd8b6c (patch) | |
tree | f3b8b4cd6858246e85cd15957d0827f05e9a0422 | |
parent | ef1bfd3f2e2a5ee071c1c8a7f474629ac98d9c74 (diff) |
Append selected dir when openning dir with Editorfiledialog
-rw-r--r-- | tools/editor/editor_file_dialog.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index cbf678d6bb..90289a275e 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -336,15 +336,21 @@ void EditorFileDialog::_action_pressed() { hide(); }else if (mode==MODE_OPEN_ANY || mode==MODE_OPEN_DIR) { - String path=dir_access->get_current_dir(); - /*if (tree->get_selected()) { - Dictionary d = tree->get_selected()->get_metadata(0); - if (d["dir"]) { - path=path+"/"+String(d["name"]); - } - }*/ + path=path.replace("\\","/"); + + for(int i=0;i<item_list->get_item_count();i++) { + if (item_list->is_selected(i)) { + Dictionary d=item_list->get_item_metadata(i); + if (d["dir"]) { + path=path.plus_file(d["name"]); + + break; + } + } + } + _save_to_recent(); emit_signal("dir_selected",path); hide(); |