Skip to content
Permalink
Browse files
[processing] quote file paths in TauDEM provider
  • Loading branch information
alexbruy committed Dec 15, 2016
1 parent a848b8c commit 79cb0c3
Showing 1 changed file with 13 additions and 0 deletions.
@@ -102,6 +102,7 @@ def taudemDescriptionPath():
def executeTauDEM(command, progress):
loglines = []
loglines.append(TauDEMUtils.tr('TauDEM execution console output'))
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('"'))
@@ -118,6 +119,18 @@ def executeTauDEM(command, progress):
loglines.append(line)
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)

@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()

@staticmethod
def tr(string, context=''):
if context == '':

0 comments on commit 79cb0c3

Please sign in to comment.