#!/bin/sh

# get the absolute path of the executable
SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")

# resolve symlinks
while [ -h $SELF_PATH ]; do
    # 1) cd to directory of the symlink
    # 2) cd to the directory of where the symlink points
    # 3) get the pwd
    # 4) append the basename
    DIR=$(dirname -- "$SELF_PATH")
    SYM=$(readlink $SELF_PATH)
    SELF_PATH=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
done

#reldir=`dirname $0 || readlink`
reldir=$SELF_PATH/..
#echo reldir is 
originaldir=`pwd`
old_ld_library_path=$DYLD_FALLBACK_LIBRARY_PATH

vsl=/opt/vsl/lib

export DYLD_FALLBACK_LIBRARY_PATH=$vsl:$DYLD_FALLBACK_LIBRARY_PATH

java -classpath .:$reldir/../lib/TASS-1.2_2549.jar:$vsl/antlr-runtime.jar:$vsl/libcvc3.jar: -d64 -Djava.library.path=$vsl -Dtass.library.path=$reldir/../lib edu.udel.cis.vsl.tass.TASS $*

export DYLD_FALLBACK_LIBRARY_PATH=$old_ld_library_path
