|
28 | 28 | import os
|
29 | 29 | from processing.tools.system import (isWindows, getTempFilename)
|
30 | 30 | from processing.algs.grass7.Grass7Utils import Grass7Utils
|
| 31 | +from qgis.PyQt.QtCore import QDir |
31 | 32 | from qgis.core import QgsProcessingParameterString
|
32 | 33 | from qgis.core import QgsMessageLog
|
33 | 34 |
|
@@ -191,29 +192,29 @@ def verifyRasterNum(alg, parameters, context, rasters, mini, maxi=None):
|
191 | 192 | def createDestDir(alg, toFile):
|
192 | 193 | """ Generates an mkdir command for GRASS7 script """
|
193 | 194 | # Creates the destination directory
|
194 |
| - command = "{} {}".format( |
| 195 | + command = "{} \"{}\"".format( |
195 | 196 | "MD" if isWindows() else "mkdir -p",
|
196 |
| - os.path.dirname(toFile) |
| 197 | + QDir.toNativeSeparators(os.path.dirname(toFile)) |
197 | 198 | )
|
198 | 199 | alg.commands.append(command)
|
199 | 200 |
|
200 | 201 |
|
201 | 202 | def moveFile(alg, fromFile, toFile):
|
202 | 203 | """ Generates a move command for GRASS7 script """
|
203 | 204 | createDestDir(alg, toFile)
|
204 |
| - command = "{} {} {}".format( |
| 205 | + command = "{} \"{}\" \"{}\"".format( |
205 | 206 | "MOVE /Y" if isWindows() else "mv -f",
|
206 |
| - fromFile, |
207 |
| - toFile |
| 207 | + QDir.toNativeSeparators(fromFile), |
| 208 | + QDir.toNativeSeparators(toFile) |
208 | 209 | )
|
209 | 210 | alg.commands.append(command)
|
210 | 211 |
|
211 | 212 |
|
212 | 213 | def copyFile(alg, fromFile, toFile):
|
213 | 214 | """ Generates a copy command for GRASS7 script """
|
214 | 215 | createDestDir(alg, toFile)
|
215 |
| - command = "{} {} {}".format( |
| 216 | + command = "{} \"{}\" \"{}\"".format( |
216 | 217 | "COPY /Y" if isWindows() else "cp -f",
|
217 |
| - fromFile, |
218 |
| - toFile) |
| 218 | + QDir.toNativeSeparators(fromFile), |
| 219 | + QDir.toNativeSeparators(toFile)) |
219 | 220 | alg.commands.append(command)
|
0 commit comments