#!/bin/sh
#@+leo

#@+node:0::@file AppletRun
#@+body
#@@first #!/bin/sh
#@@language shell

APP_DIR=`dirname $0`
BIN=$APP_DIR/rox-tasklist
export PATH="$APP_DIR:$PATH"

roxclib=`FindROXCLibBin`

if [ -z "$LD_LIBRARY_PATH" ]; then
  LD_LIBRARY_PATH=`$roxclib/rox_run ROX-CLib --runtime`
else
  LD_LIBRARY_PATH=`$roxclib/rox_run ROX-CLib --runtime`:$LD_LIBRARY_PATH
fi
export LD_LIBRARY_PATH

cd $APP_DIR

if [ "$1" == "--compile" ]; then
  echo "Compiling $APP_DIR please wait..."
  cd $APP_DIR
  make
  if [ ! -x $BIN ]; then
    echo Compile Failed
  fi
  echo Press Return
  read WAIT
  exit 0
fi

if [ ! -x $BIN ]; then
  xterm -e "$0" --compile
fi

#this line is the valgrind run used for debugging rox-tasklist
#exec valgrind --num-callers=7 --leak-check=yes $BIN $@ > valgrind.log 2> valgrind.log

exec $BIN $@

#@-body
#@-node:0::@file AppletRun
#@-leo
