Skip to content

Commit 6502dba

Browse files
committedAug 8, 2018
[processing][grass] Fix bad move/copy paths in grass i.gensig/maxlik algs
Refs #19539 (cherry-picked from 282f95c)
1 parent 0230e4a commit 6502dba

File tree

1 file changed

+9
-8
lines changed
  • python/plugins/processing/algs/grass7/ext

1 file changed

+9
-8
lines changed
 

‎python/plugins/processing/algs/grass7/ext/i.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import os
2929
from processing.tools.system import (isWindows, getTempFilename)
3030
from processing.algs.grass7.Grass7Utils import Grass7Utils
31+
from qgis.PyQt.QtCore import QDir
3132
from qgis.core import QgsProcessingParameterString
3233
from qgis.core import QgsMessageLog
3334

@@ -191,29 +192,29 @@ def verifyRasterNum(alg, parameters, context, rasters, mini, maxi=None):
191192
def createDestDir(alg, toFile):
192193
""" Generates an mkdir command for GRASS7 script """
193194
# Creates the destination directory
194-
command = "{} {}".format(
195+
command = "{} \"{}\"".format(
195196
"MD" if isWindows() else "mkdir -p",
196-
os.path.dirname(toFile)
197+
QDir.toNativeSeparators(os.path.dirname(toFile))
197198
)
198199
alg.commands.append(command)
199200

200201

201202
def moveFile(alg, fromFile, toFile):
202203
""" Generates a move command for GRASS7 script """
203204
createDestDir(alg, toFile)
204-
command = "{} {} {}".format(
205+
command = "{} \"{}\" \"{}\"".format(
205206
"MOVE /Y" if isWindows() else "mv -f",
206-
fromFile,
207-
toFile
207+
QDir.toNativeSeparators(fromFile),
208+
QDir.toNativeSeparators(toFile)
208209
)
209210
alg.commands.append(command)
210211

211212

212213
def copyFile(alg, fromFile, toFile):
213214
""" Generates a copy command for GRASS7 script """
214215
createDestDir(alg, toFile)
215-
command = "{} {} {}".format(
216+
command = "{} \"{}\" \"{}\"".format(
216217
"COPY /Y" if isWindows() else "cp -f",
217-
fromFile,
218-
toFile)
218+
QDir.toNativeSeparators(fromFile),
219+
QDir.toNativeSeparators(toFile))
219220
alg.commands.append(command)

0 commit comments

Comments
 (0)
Please sign in to comment.