Merge pull request #405 from loathingKernel/develop
Support paths with spaces in pre launch command field
This commit is contained in:
commit
50ff2ae4fd
|
@ -1,5 +1,6 @@
|
|||
import json
|
||||
import platform
|
||||
import shlex
|
||||
import subprocess
|
||||
import time
|
||||
import traceback
|
||||
|
@ -76,7 +77,7 @@ class PreLaunchThread(QRunnable):
|
|||
proc = get_configured_process()
|
||||
proc.setProcessEnvironment(launch_args.environment)
|
||||
self.signals.started_pre_launch_command.emit()
|
||||
pre_launch_command = launch_args.pre_launch_command.split()
|
||||
pre_launch_command = shlex.split(launch_args.pre_launch_command)
|
||||
# self.logger.debug("Executing prelaunch command %s, %s", pre_launch_command[0], pre_launch_command[1:])
|
||||
proc.start(pre_launch_command[0], pre_launch_command[1:])
|
||||
if launch_args.pre_launch_wait:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import shlex
|
||||
import shutil
|
||||
from typing import Tuple, Type, TypeVar
|
||||
|
||||
|
@ -73,7 +74,11 @@ class LaunchSettingsBase(QGroupBox):
|
|||
def __prelaunch_edit_callback(text: str) -> Tuple[bool, str, int]:
|
||||
if not text.strip():
|
||||
return True, text, IndicatorReasonsCommon.VALID
|
||||
if not os.path.isfile(text.split()[0]) and not shutil.which(text.split()[0]):
|
||||
try:
|
||||
command = shlex.split(text)[0]
|
||||
except ValueError:
|
||||
return False, text, IndicatorReasonsCommon.WRONG_FORMAT
|
||||
if not os.path.isfile(command) and not shutil.which(command):
|
||||
return False, text, IndicatorReasonsCommon.FILE_NOT_EXISTS
|
||||
else:
|
||||
return True, text, IndicatorReasonsCommon.VALID
|
||||
|
|
|
@ -571,8 +571,8 @@ class RareGame(RareGameSlim):
|
|||
if wine_pfx:
|
||||
args.extend(["--wine-prefix", wine_pfx])
|
||||
|
||||
logger.info(f"Starting game process: ({executable} {' '.join(args)})")
|
||||
QProcess.startDetached(executable, args)
|
||||
logger.info(f"Start new Process: ({executable} {' '.join(args)})")
|
||||
self.game_process.connect_to_server(on_startup=False)
|
||||
return True
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue