Skip to content

Commit

Permalink
[processing][grass] Fix bad move/copy paths in grass i.gensig/maxlik …
Browse files Browse the repository at this point in the history
…algs

Refs #19539
  • Loading branch information
nyalldawson committed Aug 6, 2018
1 parent 3fc8e8d commit 282f95c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions python/plugins/processing/algs/grass7/ext/i.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import os
from processing.tools.system import (isWindows, getTempFilename)
from processing.algs.grass7.Grass7Utils import Grass7Utils
from qgis.PyQt.QtCore import QDir
from qgis.core import QgsProcessingParameterString
from qgis.core import QgsMessageLog

Expand Down Expand Up @@ -191,29 +192,29 @@ def verifyRasterNum(alg, parameters, context, rasters, mini, maxi=None):
def createDestDir(alg, toFile):
""" Generates an mkdir command for GRASS7 script """
# Creates the destination directory
command = "{} {}".format(
command = "{} \"{}\"".format(
"MD" if isWindows() else "mkdir -p",
os.path.dirname(toFile)
QDir.toNativeSeparators(os.path.dirname(toFile))
)
alg.commands.append(command)


def moveFile(alg, fromFile, toFile):
""" Generates a move command for GRASS7 script """
createDestDir(alg, toFile)
command = "{} {} {}".format(
command = "{} \"{}\" \"{}\"".format(
"MOVE /Y" if isWindows() else "mv -f",
fromFile,
toFile
QDir.toNativeSeparators(fromFile),
QDir.toNativeSeparators(toFile)
)
alg.commands.append(command)


def copyFile(alg, fromFile, toFile):
""" Generates a copy command for GRASS7 script """
createDestDir(alg, toFile)
command = "{} {} {}".format(
command = "{} \"{}\" \"{}\"".format(
"COPY /Y" if isWindows() else "cp -f",
fromFile,
toFile)
QDir.toNativeSeparators(fromFile),
QDir.toNativeSeparators(toFile))
alg.commands.append(command)

0 comments on commit 282f95c

Please sign in to comment.