X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=bin%2FsalomeContextUtils.py.in;h=d9b33b50af2d7822179e0753f72973f3527fe899;hb=d8edd4804d9e6513a17c497c1a30326d4ba0d677;hp=6971315d7da818150370e555a684526e0d9be525;hpb=d2eba6b9e0622cef37027558edeef4f070bbb549;p=modules%2Fkernel.git diff --git a/bin/salomeContextUtils.py.in b/bin/salomeContextUtils.py.in index 6971315d7..d9b33b50a 100644 --- a/bin/salomeContextUtils.py.in +++ b/bin/salomeContextUtils.py.in @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2013-2021 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -286,12 +286,18 @@ def getScriptsAndArgs(args=None, searchPathList=None): # Formatting scripts and args as a Bash-like command-line: # script1.py [args] ; script2.py [args] ; ... # scriptArgs is a list of ScriptAndArgs objects; their output parameters are omitted -def formatScriptsAndArgs(scriptArgs=None): +def formatScriptsAndArgs(scriptArgs=None, escapeSpaces=False): if scriptArgs is None: return "" commands = [] for sa_obj in scriptArgs: cmd = sa_obj.script + if escapeSpaces and cmd: + if sys.platform == "win32": + cmd = cmd.replace(' ', ' "', 1) + cmd = cmd + '"' + else: + cmd = cmd.replace(' ', '\ ').replace('\ ', ' ', 1) if sa_obj.args: cmd = " ".join([cmd]+sa_obj.args) commands.append(cmd)