mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-29 00:46:32 +02:00
[core] String formatting of parameters with/without quotes to deal with spaces in strings
We have the problem of spaces in file paths, choices (like colorspace), etc. An empty list is not send to the command line. An empty string is send to the command line as "". Add new unit test to ensure it follows the expected rules.
This commit is contained in:
parent
1141d44bce
commit
a7fc167512
3 changed files with 98 additions and 7 deletions
|
@ -711,8 +711,12 @@ class BaseNode(BaseObject):
|
|||
# if there is a valid command line "group"
|
||||
v = attr.getValueStr()
|
||||
cmdVars[name] = '--{name} {value}'.format(name=name, value=v)
|
||||
cmdVars[name + 'Value'] = str(v)
|
||||
cmdVars[name + 'Value'] = v
|
||||
|
||||
# List elements may give a fully empty string and will not be sent to the command line.
|
||||
# String attributes will return only quotes if it is empty and thus will be send to the command line.
|
||||
# But a List of string containing 1 element,
|
||||
# and this element is an empty string will also return quotes and will be send to the command line.
|
||||
if v:
|
||||
cmdVars[group] = cmdVars.get(group, '') + ' ' + cmdVars[name]
|
||||
elif isinstance(attr, GroupAttribute):
|
||||
|
@ -762,7 +766,7 @@ class BaseNode(BaseObject):
|
|||
v = attr.getValueStr()
|
||||
|
||||
self._cmdVars[name] = '--{name} {value}'.format(name=name, value=v)
|
||||
self._cmdVars[name + 'Value'] = str(v)
|
||||
self._cmdVars[name + 'Value'] = v
|
||||
|
||||
if v:
|
||||
self._cmdVars[attr.attributeDesc.group] = self._cmdVars.get(attr.attributeDesc.group, '') + \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue