Feature request #21127

Use relative paths in qgis-bin.env

Added by Michiel Nass about 5 years ago. Updated about 5 years ago.

Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:28945


In file OSGEO4W_ROOT\bin\qgis-bin.env the drive letter of the QGIS installation is hard coded.

To allow for portable edition (changing drive letters) of QGIS using relative paths or variables like OSGEO4W_ROOT is preferable.


#1 Updated by Jürgen Fischer about 5 years ago

  • Status changed from Open to Feedback

The .env is created by the .exe when it's invoked with the --postinstall parameter and dumps the current values of the environment variables listed in .vars to it. The point of the .env is that QGIS doesn't need environment variables to start - this is required for pinning as that automatically starts the pinned .exe and doesn't know about the batch files used for a regular start. The .exe will source the .env automatically. For portable installations you could change the batch file to delete the .env and run the .exe with --postinstall upfront (on regular installations this is done once in etc/postinstall/qgis.bat)

#2 Updated by Michiel Nass about 5 years ago

Please elaborate.

I normally start QGIS via batch file %OSGEO4W_ROOT%\bin\qgis.bat.

The last line of that batch file I edited to make it portable and it reads:

start "QGIS" /B "%OSGEO4W_ROOT%\bin\qgis-bin.exe" --profiles-path "%OSGEO4W_ROOT%\qgisini" %*

Do i understand correctly I have to replace the last line with the following two lines?

del "%OSGEO4W_ROOT%\bin\qgis-bin.env"
start "QGIS" /B "%OSGEO4W_ROOT%\bin\qgis-bin.exe" --profiles-path "%OSGEO4W_ROOT%\qgisini" --postinstall %*

#3 Updated by Jürgen Fischer about 5 years ago

del "%OSGEO4W_ROOT%\bin\qgis-bin.env" 
"%OSGEO4W_ROOT%\bin\qgis-bin.exe" --postinstall
start "QGIS" /B "%OSGEO4W_ROOT%\bin\qgis-bin.exe" --profiles-path "%OSGEO4W_ROOT%\qgisini" %*

Also available in: Atom PDF