Fixed the fallback logic of OS::shell_show_in_file_manager

This commit is contained in:
Daylily-Zeleen
2023-07-06 13:14:08 +08:00
parent cdd2313ba2
commit 9dd9818c88
2 changed files with 7 additions and 5 deletions

View File

@ -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?