#!/bin/sh
MYDIR=$(dirname $0)
#QT_LIB_DIR=$(dirname $(which qmake))/../lib
QT_LIB_DIR=/home/user/qt6/lib
QMMP_LIB_DIRS=$MYDIR/../lib:$MYDIR/../src/qmmpui

if [ -z ${LD_LIBRARY_PATH} ]; then
    LD_LIBRARY_PATH=${QMMP_LIB_DIRS}:${QT_LIB_DIR}
else
    LD_LIBRARY_PATH=${QMMP_LIB_DIRS}:${QT_LIB_DIR}:${LD_LIBRARY_PATH}
fi

echo 'Setting LD_LIBRARY_PATH to'
echo "$LD_LIBRARY_PATH" | awk -F: '{ for(i = 1; i <= NF; i++) printf "%d) %s\n", i, $i; }'
export LD_LIBRARY_PATH
echo

exec $MYDIR/qmmp "$@"
