Bug report #21665
Virtual layers are always stored with absolute paths
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Virtual Layers | ||
Affected QGIS version: | 3.7(master) | Regression?: | No |
Operating System: | any | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 29481 |
Description
Paths to data sources of virtual layers always use full paths when stored in projects (and full paths are expected when reading project files). This makes projects with virtual layers using file-based sources non-portable between different machines.
Steps to reproduce:
1. create a virtual layer with a shapefile as a source
2. store as a project
3. move the project and shapefile to a new directory -> virtual layers is invalid
There are QgsVectorLayer::encodedSource() and QgsVectorLayer::decodedSource() methods that will need adjusting.