Bug report #17116

QGIS master saves always with absolute paths

Added by Patrick Dunford about 7 years ago. Updated over 6 years ago.

Status:Closed
Priority:High
Assignee:Alessandro Pasotti
Category:Project Loading/Saving
Affected QGIS version:master Regression?:Yes
Operating System:Xubuntu 17.04 Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:25015

Description

This issue was addressed only in 2.18 to date. Master 313ec55 (January 2017) and 655f121 (September 2017) on Linux both produce the problem. 1182816 (January 2017) on Windows does not.

Attached new project created in latest available build 655f121.

<layer-tree-layer source="/mnt/share/mainpc/maps/Google Drive/NZ Rail Maps/Projects/CanterburyWestlandNelsonMarlborough/Main/cwmnNelsonSection.shp" expanded="1" name="cwmnNelsonSection" checked="Qt::Checked" id="cwmnNelsonSection_2225c913_8062_4cd1_817e_73ffeb6cec35" providerKey="ogr">

should read something like "./Main/cwmnNelsonSection.shp" given the shapefile is in a subdirectory below the location of the project file. If I open that project file in Windows it will obviously fail with the different network mapping (to a drive letter).

<Paths>
<Absolute type="bool">false</Absolute>
</Paths>
so project properties are set to relative file paths.

This sounds exactly like the description of #16242 given it only happens at new project creation or saving an existing project under a new name. In the course of using various masters on different platforms (for example, using both Windows and Linux to work on the same project file on the same day) interchanging existing projects between Windows and Linux platforms have not actually shown up this problem before. Until yesterday when I saved a project under a new name on 313ec55 and tried to open it in Windows, could not load a single layer in the Windows vm.

655f121.qgs (10.8 KB) Patrick Dunford, 2017-09-08 02:11 PM

Associated revisions

Revision 7aa24f69
Added by Alessandro Pasotti almost 7 years ago

[bugfix] Pass QgsReadWriteContext into project XML r/w

Or we miss the path resolver and we do not read/write
relative paths correctly

Fixes #17116

History

#1 Updated by Giovanni Manghi about 7 years ago

  • Subject changed from QGIS 2.99 (2017) saves always with absolute paths [duplicate of #16242] to QGIS master saves always with absolute paths
  • Priority changed from Normal to High
  • Regression? changed from No to Yes

#2 Updated by Alessandro Pasotti almost 7 years ago

  • Assignee set to Alessandro Pasotti

#3 Updated by Anonymous almost 7 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#4 Updated by magerlin - almost 7 years ago

Qgis 2.18.15 also has this issue: Creating a new project completely from scratch (with project options set to relative paths), saving the project in c:\@temp and then adding a shp file from the same folder as the project is stored in adds this to the project file:

&lt;layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="2stat_befolk20171230182502788" source="C:\@Temp\2stat_befolk.shp" name="2stat_befolk"&gt;

I am using Win 7, 64 bit, QGIS code revision ac2d111ed1

#5 Updated by Steve Lowman almost 7 years ago

Can we re-open this please. Relative paths are not working in 2.18.15, as already reported above by magerlin.

#6 Updated by Patrick Dunford almost 7 years ago

The bug report for Qgis 2.18 saves with absolute paths is at #16242

please direct your comments to that bug report.

#7 Updated by Patrick Dunford almost 7 years ago

Please file a new bug report as this report is closed

#8 Updated by Steve Lowman almost 7 years ago

Thanks. I see you already have done this in #17824

#9 Updated by Giovanni Manghi over 6 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF