#!/bin/sh
# Shell wrapper for rkward executable.

R_HOME_DIR="/usr/lib/R"
R_binary="$R_HOME_DIR/bin/R"

## Location of R may have moved, so check
if test -x "${R_binary}"; then
  :
else
  error "R binary ('${R_binary}') not found. Most likely your installation of R has moved to a new location. Please rebuild rkward."
fi

## Apparently on some systems an embedded R gets outsmarted somehow, and LC_NUMERIC is set to some dangerous value for the whole app (likely via some Qt stuff)
## To prevent this, set it here, explicitely. R does not work with wrong settings of LC_NUMERIC.
export LC_NUMERIC="C"

## Start rkward. Running through R CMD to set all the relevant R enviroment variables
exec $R_binary CMD $0.bin "$@"
