File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
python/plugins/processing/algs/taudem Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ def taudemDescriptionPath():
102
102
def executeTauDEM (command , progress ):
103
103
loglines = []
104
104
loglines .append (TauDEMUtils .tr ('TauDEM execution console output' ))
105
+ command = TauDEMUtils .escapeAndJoin (command )
105
106
fused_command = '' .join (['"%s" ' % c for c in command ])
106
107
progress .setInfo (TauDEMUtils .tr ('TauDEM command:' ))
107
108
progress .setCommand (fused_command .replace ('" "' , ' ' ).strip ('"' ))
@@ -118,6 +119,18 @@ def executeTauDEM(command, progress):
118
119
loglines .append (line )
119
120
ProcessingLog .addToLog (ProcessingLog .LOG_INFO , loglines )
120
121
122
+ @staticmethod
123
+ def escapeAndJoin (strList ):
124
+ joined = ''
125
+ for s in strList :
126
+ if s [0 ] != '-' and ' ' in s :
127
+ escaped = '"' + s .replace ('\\ ' , '\\ \\ ' ).replace ('"' , '\\ "' ) \
128
+ + '"'
129
+ else :
130
+ escaped = s
131
+ joined += escaped + ' '
132
+ return joined .strip ()
133
+
121
134
@staticmethod
122
135
def tr (string , context = '' ):
123
136
if context == '' :
You can’t perform that action at this time.
0 commit comments