Skip to content
Permalink
Browse files
[processing] add missed escapeAndJoin function to TauDEM provider
  • Loading branch information
alexbruy committed Mar 28, 2017
1 parent 140a01f commit ad86dc06dff15bc8b33d93d79c83f286068f1dc2
Showing with 13 additions and 1 deletion.
  1. +13 −1 python/plugins/processing/algs/taudem/TauDEMUtils.py
@@ -102,7 +102,7 @@ def taudemDescriptionPath():
def executeTauDEM(command, progress):
loglines = []
loglines.append(TauDEMUtils.tr('TauDEM execution console output'))
command = escapeAndJoin(command)
command = TauDEMUtils.escapeAndJoin(command)
fused_command = ''.join(['"%s" ' % c for c in command])
progress.setInfo(TauDEMUtils.tr('TauDEM command:'))
progress.setCommand(fused_command.replace('" "', ' ').strip('"'))
@@ -124,3 +124,15 @@ def tr(string, context=''):
if context == '':
context = 'TauDEMUtils'
return QCoreApplication.translate(context, string)

@staticmethod
def escapeAndJoin(strList):
joined = ''
for s in strList:
if s[0] != '-' and ' ' in s:
escaped = '"' + s.replace('\\', '\\\\').replace('"', '\\"') \
+ '"'
else:
escaped = s
joined += escaped + ' '
return joined.strip()

0 comments on commit ad86dc0

Please sign in to comment.