qgis / QGIS-Mac-Packager

Scripts for Official QGIS MacOS Packages
https://www.qgis.org
GNU General Public License v2.0
54 stars 21 forks source link

GDAL tools using bash scripts don't work when the path to QGIS.app has spaces #174

Open kidhanis opened 9 months ago

kidhanis commented 9 months ago

QGIS version 3.32.2-Lima, running in MacOS 10.13.6. The app is installed in /Applications/My Tools/QGIS.app.

I'm trying to use Raster -> Miscellaneous -> Raster Information, which uses gdalinfo. Once I add an input layer and press Run, I get the following: /Applications/My Tools/QGIS.app/Contents/MacOS/bin/gdalinfo: line 3: /Applications/My: No such file or directory The path is stopping at the space in "My Tools". If I move QGIS to /Applications/QGIS.app then everything works fine.

The same error occurs if I run gdalinfo from /Applications/My Tools/QGIS.app/Contents/MacOS/bin/gdalinfo. In fact, the behavior seems to happen only with GDAL commands that first execute a bash script.

This is the script for gdalinfo, which might be created by QGIS-Mac-Packager/qgis_bundle/recipes/gdal/recipe.sh#L48-L50:

#!/bin/bash
THISDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
$THISDIR/run_gdal_binary.bash "gdalinfo" "$@"

The error can be fixed by adding quotes around $THISDIR in the last line.