#!/bin/bash

current_exe_dir=$(dirname $0)

# Does readlink -f work on MacOSX? Possibly not. I don't know what to
# do about it yet.

systype=$(uname)

if [ $systype = Darwin ] ; then 
   prfx=$(dirname "$current_exe_dir")
   if [ -z "$DYLD_FALLBACK_LIBRARY_PATH" ] ;  then
	DYLD_FALLBACK_LIBRARY_PATH=$prfx/lib
   else 
	DYLD_FALLBACK_LIBRARY_PATH=$prfx/lib:${DYLD_FALLBACK_LIBRARY_PATH}
   fi
   export DYLD_FALLBACK_LIBRARY_PATH
else
   prfx=$(readlink -f $(dirname "$current_exe_dir"))
   export LD_LIBRARY_PATH=$prfx/lib
fi

# need to add rdkit dlls (in lib)
if [[ "$systype" == MINGW* ]] ; then
   PATH=$prfx/lib:$PATH
fi

# no point in --check-libs - we are running python and dynamically loading the libs

# echo DYLD_FALLBACK_LIBRARY_PATH $DYLD_FALLBACK_LIBRARY_PATH
export PATH=$prfx/bin:$PATH

/home/paule/autobuild/Linux-penelope-arch-gtk4/bin/python3.11 -m pyrogen "${@}"
