#!/bin/bash
set -e
# load variables
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
VARS="$DIR/.vars.conf"
PYTHON_INTERPRETER=$(
    grep '^PYTHON_INTERPRETER=' "$VARS" | cut -d= -f2-
)
# check PYTHON_INTERPRETER is defined
if [ -z "$PYTHON_INTERPRETER" ]; then
    echo "Error : PYTHON_INTERPRETER not defined in .vars.conf"
    exit 1
fi


# launch script (QGIS is the interpreter because of bundle and notarized python)
QT_QPA_PLATFORM=offscreen "$PYTHON_INTERPRETER/QGIS" --nologo --code "$DIR/auto_import.py" --py-args "$@"
