diff options
author | Daylily-Zeleen <daylily-zeleen@foxmail.com> | 2023-07-06 13:14:08 +0800 |
---|---|---|
committer | Daylily-Zeleen <daylily-zeleen@foxmail.com> | 2023-07-06 13:16:04 +0800 |
commit | 9dd9818c8860cd1719ca73f7ce878b9078de4af9 (patch) | |
tree | 73d19cf6ec76c64058eda814e679e852155d0ccf /core/os/os.cpp | |
parent | cdd2313ba27d0a2600a18e849b4c5d1fd6a6e351 (diff) | |
download | redot-engine-9dd9818c8860cd1719ca73f7ce878b9078de4af9.tar.gz |
Fixed the fallback logic of OS::shell_show_in_file_manager
Diffstat (limited to 'core/os/os.cpp')
-rw-r--r-- | core/os/os.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/os/os.cpp b/core/os/os.cpp index 5704ef7a40..67423128a3 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -295,12 +295,14 @@ Error OS::shell_open(String p_uri) { } Error OS::shell_show_in_file_manager(String p_path, bool p_open_folder) { - if (!p_path.begins_with("file://")) { - p_path = String("file://") + p_path; - } - if (!p_path.ends_with("/")) { + p_path = p_path.trim_prefix("file://"); + + if (!DirAccess::dir_exists_absolute(p_path)) { p_path = p_path.get_base_dir(); } + + p_path = String("file://") + p_path; + return shell_open(p_path); } // implement these with the canvas? |