[QGIS-Developer] ProcessingAlgorithm: get filename of the INPUT param

Nyall Dawson nyall.dawson at gmail.com
Wed Jun 19 15:47:35 PDT 2019


On Wed, 19 Jun 2019 at 22:20, Richard Duivenvoorde <rdmailings at duif.net> wrote:
>
> Hi,
>
> got a question from somebody who needed to find the filename of an input
> param in a ProcessingAlgorithm
> (because he is going to read that file again or something like that).

Short answer -- it's not possible, and if you DO find a workaround, DON'T do it.

By design feature sources aren't layers, and the features coming from
a feature source may not even be associated with any layer at all. If
you need to get the path to a input file, you should be using a vector
layer parameter instead (but be very careful of thread safety issues,
and consider returning the FlagNoThreading flag for your algorithm to
ensure it's not crashy)

Nyall


More information about the QGIS-Developer mailing list