Bug report #15019

Paths should be fully adjusted to each OS

Added by Paolo Cavallini over 8 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Symbology
Affected QGIS version:2.14.3 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:22966

Description

Paths to system SVG, both in projects and in layout templates, should not be saved as fixed, absolute, but replaced with the appropriate path for each OS. e.g. /usr/share/qgis/svg/ on Linux should be replaced with C:/OSGeo4w/apps/qgis/./svg
Similarly for OSX and other systems.
Currently this makes it impossible to share print layouts and projects with symbols across OSs, so it's rather significant in an enterprise context.

History

#1 Updated by Alessandro Pasotti over 8 years ago

If we don't succeed in convincing Microsoft and Apple to adhere to LSB and POSIX, what do you think would be a possible solution?

The only possible solution to me seems that the SVG paths are stored as relative to the SVG folders that are configured in the global settings and then searched in those folders.

The question is: if you set the project properties to store paths relatively, does QGIS still stores the full SVG path?

If yes, I'd say this would be a bug.

#2 Updated by Frank Sokolic over 8 years ago

I've just tested on Master on Ubuntu 16.04 and it saves the absolute SVG path even when the project properties is set to use relative paths.

    <Paths>
      <Absolute type="bool">false</Absolute>
    </Paths>

      <ComposerPicture resizeMode="0" svgBorderWidth="0" pictureRotation="0" pictureWidth="37.0684" svgFillColor="0,0,0,255" svgBorderColor="255,255,255,255" file="/usr/share/qgis/svg/gpsicons/bank.svg" pictureHeight="37.0684" mapId="-1" anchorPoint="0">
        <ComposerItem pagey="92.4627" page="1" id="" lastValidViewScaleFactor="-1" positionMode="0" positionLock="false" x="190.34" y="92.4627" visibility="1" zValue="2" background="false" transparency="0" frameJoinStyle="miter" blendMode="0" width="40.8169" outlineWidth="0.3" excludeFromExports="0" uuid="{d92a2cea-192a-468a-a158-d9c68fea45cf}" height="37.0684" itemRotation="0" frame="false" pagex="190.34">
          <FrameColor alpha="255" red="0" blue="0" green="0"/>
          <BackgroundColor alpha="255" red="255" blue="255" green="255"/>
          <dataDefinedSource expr="" field="" active="false" useExpr="true"/>
          <customproperties/>
        </ComposerItem>
      </ComposerPicture>

#3 Updated by Paolo Cavallini over 8 years ago

QGIS is however able to replace the paths according to its installation, so why this variable could not be used inside a project or layout template?

#4 Updated by Matthias Kuhn over 8 years ago

I think paths to files from global directories should be saved relative.

Then when looking up (relative) files, they should be searched in this order:

1. relative to project directory
2. relative to svg path directories. Every system can then search the file in the configured folders.

Or we also save another flag that specifies if a file is relative to global or relative to project path to avoid collisions.

#5 Updated by Jürgen Fischer over 8 years ago

  • Subject changed from Paths shoud be fully adjusted to each OS to Paths should be fully adjusted to each OS

#6 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Paolo Cavallini over 6 years ago

  • Resolution set to fixed/implemented
  • Description updated (diff)
  • Status changed from Open to Closed

Seems fixed now. Paths in projects are relative:

<prop k="svgFile" v="gpsicons/skull.svg"/>

Also available in: Atom PDF