소스 검색

Windows: Always double-quote path when launching explorer.exe to browse

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.

(cherry picked from commit 5608b1d4117c4d7931905f8109d39cba6fa2128f)
Brecht Kuppens 2 년 전
부모
커밋
4944a07044
1개의 변경된 파일2개의 추가작업 그리고 7개의 파일을 삭제
  1. 2 7
      platform/windows/os_windows.cpp

+ 2 - 7
platform/windows/os_windows.cpp

@@ -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("/", "\\");