[processing] fix substitution of the original layers in GDAL commands

This commit is contained in:
Alexander Bruy 2016-09-14 16:24:02 +03:00
parent 2466083790
commit 89774abed3

View File

@ -26,6 +26,7 @@ __copyright__ = '(C) 2012, Victor Olaya'
__revision__ = '$Format:%H$'
import os
import re
from qgis.PyQt.QtGui import QIcon
@ -58,7 +59,9 @@ class GdalAlgorithm(GeoAlgorithm):
c = c.replace(layer.source(), exported)
if os.path.isfile(layer.source()):
fileName = os.path.splitext(os.path.split(layer.source())[1])[0]
c = c.replace(' ' + fileName + ' ', ' ' + exportedFileName + ' ')
c = re.sub('[\s]{}[\s]'.format(fileName), ' ' + exportedFileName + ' ', c)
c = re.sub('[\s]{}'.format(fileName), ' ' + exportedFileName, c)
c = re.sub('["\']{}["\']'.format(fileName), "'" + exportedFileName + "'", c)
commands[i] = c
GdalUtils.runGdal(commands, progress)