-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement and expose OS.shell_show_in_file_manager()
#69698
Implement and expose OS.shell_show_in_file_manager()
#69698
Conversation
1e23af2
to
4bf69e0
Compare
1201d28
to
691ef15
Compare
I investigated the focus issue I mentioned before and it's caused by the editor. If the editor window is not focused while the command is executed, the folder correctly opens in front instead in background. |
Does this PR fix #64568? |
3c43cda
to
036b106
Compare
Now fixed. Fix.mp4 |
e0c8b73
to
0e7c980
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if p_open_folder
parameter is needed, in the codebase it seems we always do want to open the folder. But it might be nice to have it exposed even if it's not used internally. Fine for me.
editor/filesystem_dock.cpp
Outdated
if (fpath == "res://") { | ||
// This case means that right click at the spcace area in FilesystemDock. | ||
// Enter resource folder directly. | ||
OS::get_singleton()->shell_show_in_explorer(dir, true); | ||
} else { | ||
OS::get_singleton()->shell_show_in_explorer(dir, false); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that in such case the menu entry is "Open in File Manager", it's expected to open the folder instead of just showing it:
https://github.com/godotengine/godot/blob/0e7c98061856a171838f4ae41e2ca925158e24aa/editor/filesystem_dock.cpp#L2604
I don't think it needs to be changed.
if (fpath == "res://") { | |
// This case means that right click at the spcace area in FilesystemDock. | |
// Enter resource folder directly. | |
OS::get_singleton()->shell_show_in_explorer(dir, true); | |
} else { | |
OS::get_singleton()->shell_show_in_explorer(dir, false); | |
} | |
OS::get_singleton()->shell_show_in_explorer(dir, true); |
Only the Windows part? There also #64568 (comment) in there (could be done later/separately, asking just for confirmation). |
Yes, I have not linux device, I can't be responsible for that。 |
Also, macOS version for the reference - #65890 (comment) |
0e7c980
to
b55a739
Compare
Wouldn't be better for the function's name to be |
49aab49
to
c9fa01d
Compare
@KoBeWi @kleonc I noticed that my implement is the same as the VSCode's behavior of "show in file manager". However, UE editor's behavior is the same as your description. |
Well, the option does say "Open in File Explorer" when you right-click directory. It has different text. So either it should be made the same or maybe both could be available. But IMO it's better to keep the current behavior, i.e. opening the folder. Selecting a folder is much less common operation and also makes it impossible to navigate to empty folders. |
c9fa01d
to
a3ee288
Compare
I approve your opinion, my editor local language put the verb at the end of this option, and I never noticed the diffrenet between right-click file and folder. |
a3ee288
to
8ed1147
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message should be changed to reflect the function's current name.
8ed1147
to
b12ced0
Compare
Thanks! |
OS.shell_show_in_file_manager()
Implement 'OS::shell_show_in_file_manager()' for FilesystemDock and expose to GDScript.
Currently only implement for Windows, because I only have a windows device.
On other platforms, it will fallback to origin action.
I hope someone can implement for other platforms.
QQ.20220916183403.mp4
Replace #67071.
Fixed #64568.