Skip to content

Commit

Permalink
Windows: Always double-quote path when launching explorer.exe to browse
Browse files Browse the repository at this point in the history
Code now always double quotes the filename to use as command line
argument when calling explorer.exe. In particular, commas in a filename
would be interpreted by explorer.exe as separators for commands.

Similarly a trim_suffix for "file://" is assumed to be a mistake, this
could potentially be a PREfix that we want to strip, but never a suffix.
Since it didn't seem needed in the end, we removed it.
  • Loading branch information
bgie authored and akien-mga committed Aug 28, 2023
1 parent f2acfb1 commit 5608b1d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions platform/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
p_path = p_path.trim_suffix("file://");

bool open_folder = false;
if (DirAccess::dir_exists_absolute(p_path) && p_open_folder) {
open_folder = true;
}

if (p_path.begins_with("\"")) {
p_path = String("\"") + p_path;
}
if (p_path.ends_with("\"")) {
p_path = p_path + String("\"");
if (!p_path.is_quoted()) {
p_path = p_path.quote();
}
p_path = p_path.replace("/", "\\");

Expand Down

0 comments on commit 5608b1d

Please sign in to comment.