diff options
author | Nikodem Lokatelj <nikodem.lokatelj@interblockgaming.com> | 2018-03-28 11:34:46 +0200 |
---|---|---|
committer | Nikodem Lokatelj <nikodem.lokatelj@interblockgaming.com> | 2018-03-28 11:34:46 +0200 |
commit | 836565b2493b9f5b39c885cab35b40457604c306 (patch) | |
tree | 9ac9f76f23900d62e8b414ca1ea820fdc88dddd1 | |
parent | 4a5723f59e0437dc9f83f7116b8fddd12e15c5d0 (diff) |
FIX: FILE_SHOW_IN_EXPLORER now correctly shows the file's directory
-rw-r--r-- | editor/filesystem_dock.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 9bfa50148f..f847382995 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1034,8 +1034,19 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path) { void FileSystemDock::_file_option(int p_option) { switch (p_option) { case FILE_SHOW_IN_EXPLORER: { - String dir = ProjectSettings::get_singleton()->globalize_path(this->path); - OS::get_singleton()->shell_open(String("file://") + dir); + + String path = this->path; + + // first try to grab directory from selected file, so that it works for searched files + int idx = files->get_current(); + + if (idx >= 0 && idx < files->get_item_count()) { + path = files->get_item_metadata(idx); + path = path.get_base_dir(); + } + + path = ProjectSettings::get_singleton()->globalize_path(path); + OS::get_singleton()->shell_open(String("file://") + path); } break; case FILE_OPEN: { for (int i = 0; i < files->get_item_count(); i++) { |