1
0
Fork 0
mirror of synced 2024-06-10 22:54:41 +12:00

PreLaunch: Quote the selected file path if it contains spaces.

This commit is contained in:
loathingKernel 2024-05-18 18:15:25 +03:00
parent 6594d65be1
commit 259bc98eb9

View file

@ -1,6 +1,7 @@
import os
from enum import IntEnum
from logging import getLogger
import shlex
from typing import Callable, Tuple, Optional, Dict, List
from PyQt5.QtCore import (
@ -336,6 +337,8 @@ class PathEdit(IndicatorLineEdit):
if self.__name_filter:
dlg.setNameFilter(" ".join(self.__name_filter))
if dlg.exec_():
names = dlg.selectedFiles()
self.line_edit.setText(names[0])
self.__completer_model.setRootPath(names[0])
name = dlg.selectedFiles()[0]
if " " in name:
name = shlex.quote(name)
self.line_edit.setText(name)
self.__completer_model.setRootPath(name)