Skip to content

Commit ad86dc0

Browse files
committed
[processing] add missed escapeAndJoin function to TauDEM provider
1 parent 140a01f commit ad86dc0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

python/plugins/processing/algs/taudem/TauDEMUtils.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def taudemDescriptionPath():
102102
def executeTauDEM(command, progress):
103103
loglines = []
104104
loglines.append(TauDEMUtils.tr('TauDEM execution console output'))
105-
command = escapeAndJoin(command)
105+
command = TauDEMUtils.escapeAndJoin(command)
106106
fused_command = ''.join(['"%s" ' % c for c in command])
107107
progress.setInfo(TauDEMUtils.tr('TauDEM command:'))
108108
progress.setCommand(fused_command.replace('" "', ' ').strip('"'))
@@ -124,3 +124,15 @@ def tr(string, context=''):
124124
if context == '':
125125
context = 'TauDEMUtils'
126126
return QCoreApplication.translate(context, string)
127+
128+
@staticmethod
129+
def escapeAndJoin(strList):
130+
joined = ''
131+
for s in strList:
132+
if s[0] != '-' and ' ' in s:
133+
escaped = '"' + s.replace('\\', '\\\\').replace('"', '\\"') \
134+
+ '"'
135+
else:
136+
escaped = s
137+
joined += escaped + ' '
138+
return joined.strip()

0 commit comments

Comments
 (0)