@@ -116,6 +116,7 @@ def __init__(self, descriptionfile):
116
116
self .commands = []
117
117
self .outputCommands = []
118
118
self .exportedLayers = {}
119
+ self .fileOutputs = {}
119
120
self .descriptionFile = descriptionfile
120
121
121
122
# Default GRASS parameters
@@ -398,6 +399,7 @@ def processAlgorithm(self, original_parameters, context, feedback):
398
399
self .commands = []
399
400
self .outputCommands = []
400
401
self .exportedLayers = {}
402
+ self .fileOutputs = {}
401
403
402
404
# If GRASS session has been created outside of this algorithm then
403
405
# get the list of layers loaded in GRASS otherwise start a new
@@ -442,9 +444,15 @@ def processAlgorithm(self, original_parameters, context, feedback):
442
444
for out in self .outputDefinitions ():
443
445
outName = out .name ()
444
446
if outName in parameters :
445
- outputs [outName ] = parameters [outName ]
447
+ if outName in self .fileOutputs :
448
+ print ('ADD' , outName )
449
+ print ('VAL' , parameters [outName ])
450
+ print ('VAL 2' , self .fileOutputs [outName ])
451
+ outputs [outName ] = self .fileOutputs [outName ]
452
+ else :
453
+ outputs [outName ] = parameters [outName ]
446
454
if isinstance (out , QgsProcessingOutputHtml ):
447
- self .convertToHtml (parameters [outName ])
455
+ self .convertToHtml (self . fileOutputs [outName ])
448
456
449
457
return outputs
450
458
@@ -643,23 +651,18 @@ def processCommand(self, parameters, context, feedback, delOutputs=False):
643
651
# For File destination
644
652
if isinstance (out , QgsProcessingParameterFileDestination ):
645
653
if outName in parameters and parameters [outName ] is not None :
654
+ outPath = self .parameterAsFileOutput (parameters , outName , context )
655
+ self .fileOutputs [outName ] = outPath
646
656
# for HTML reports, we need to redirect stdout
647
657
if out .defaultFileExtension ().lower () == 'html' :
648
658
if outName == 'html' :
649
659
# for "fake" outputs redirect command stdout
650
- command += ' > "{}"' .format (
651
- self .parameterAsFileOutput (
652
- parameters , outName , context )
653
- )
660
+ command += ' > "{}"' .format (outPath )
654
661
else :
655
662
# for real outputs only output itself should be redirected
656
- command += ' {}=- > "{}"' .format (
657
- outName ,
658
- self .parameterAsFileOutput (parameters , outName , context ))
663
+ command += ' {}=- > "{}"' .format (outName , outPath )
659
664
else :
660
- command += ' {}="{}"' .format (
661
- outName ,
662
- self .parameterAsFileOutput (parameters , outName , context ))
665
+ command += ' {}="{}"' .format (outName , outPath )
663
666
# For folders destination
664
667
elif isinstance (out , QgsProcessingParameterFolderDestination ):
665
668
# We need to add a unique temporary basename
0 commit comments