Skip to content
Permalink
Browse files

[processing][grass] Fix bad move/copy paths in grass i.gensig/maxlik …

…algs

Refs #19539
  • Loading branch information
nyalldawson committed Aug 6, 2018
1 parent 3fc8e8d commit 282f95c9f790f9e9509dbe1520bc0a34e399d18f
Showing with 9 additions and 8 deletions.
  1. +9 −8 python/plugins/processing/algs/grass7/ext/i.py
@@ -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

@@ -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.
You can’t perform that action at this time.