Add 'Show In System' option into filesystem RMB menu
This commit is contained in:
parent
926495d8eb
commit
5ad6480979
2 changed files with 18 additions and 2 deletions
|
@ -944,6 +944,7 @@ void ScenesDock::_file_option(int p_option) {
|
|||
switch(p_option) {
|
||||
|
||||
|
||||
case FILE_SHOW_IN_EXPLORER:
|
||||
case FILE_OPEN: {
|
||||
int idx=-1;
|
||||
for(int i=0;i<files->get_item_count();i++) {
|
||||
|
@ -959,6 +960,17 @@ void ScenesDock::_file_option(int p_option) {
|
|||
|
||||
|
||||
String path = files->get_item_metadata(idx);
|
||||
if (p_option == FILE_SHOW_IN_EXPLORER) {
|
||||
String dir = DirAccess::get_full_path("res://", DirAccess::ACCESS_FILESYSTEM);
|
||||
const int res_begin = String("res://").length();
|
||||
const int last_sep = path.find_last("/");
|
||||
if (last_sep > res_begin) {
|
||||
dir += "/";
|
||||
dir += path.substr(res_begin, last_sep - res_begin);
|
||||
}
|
||||
OS::get_singleton()->shell_open(String("file://")+dir);
|
||||
return;
|
||||
}
|
||||
|
||||
if (path.ends_with("/")) {
|
||||
if (path!="res://") {
|
||||
|
@ -1416,6 +1428,10 @@ void ScenesDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) {
|
|||
|
||||
file_options->add_item(TTR("Delete"),FILE_REMOVE);
|
||||
//file_options->add_item(TTR("Info"),FILE_INFO);
|
||||
|
||||
file_options->add_separator();
|
||||
file_options->add_item(TTR("Show In System"),FILE_SHOW_IN_EXPLORER);
|
||||
|
||||
file_options->set_pos(files->get_global_pos() + p_pos);
|
||||
file_options->popup();
|
||||
|
||||
|
@ -1635,4 +1651,3 @@ ScenesDock::ScenesDock(EditorNode *p_editor) {
|
|||
ScenesDock::~ScenesDock() {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ class ScenesDock : public VBoxContainer {
|
|||
FILE_MOVE,
|
||||
FILE_REMOVE,
|
||||
FILE_REIMPORT,
|
||||
FILE_INFO
|
||||
FILE_INFO,
|
||||
FILE_SHOW_IN_EXPLORER
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue