Merge pull request #78963 from bgie/comma_in_filename

Windows: Always double-quote path when launching explorer.exe to browse
This commit is contained in:
Rémi Verschelde 2023-08-28 15:01:49 +02:00
commit 6584cd88d9
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -1356,18 +1356,13 @@ Error OS_Windows::shell_open(String p_uri) {
} }
Error OS_Windows::shell_show_in_file_manager(String p_path, bool p_open_folder) { Error OS_Windows::shell_show_in_file_manager(String p_path, bool p_open_folder) {
p_path = p_path.trim_suffix("file://");
bool open_folder = false; bool open_folder = false;
if (DirAccess::dir_exists_absolute(p_path) && p_open_folder) { if (DirAccess::dir_exists_absolute(p_path) && p_open_folder) {
open_folder = true; open_folder = true;
} }
if (p_path.begins_with("\"")) { if (!p_path.is_quoted()) {
p_path = String("\"") + p_path; p_path = p_path.quote();
}
if (p_path.ends_with("\"")) {
p_path = p_path + String("\"");
} }
p_path = p_path.replace("/", "\\"); p_path = p_path.replace("/", "\\");