#!/bin/bash
#This script should not be launched unless sandbox installed in /usr/local/sandbox 
# SANDBOX_DIR should refer to the directory in which sandbox is placed.
#SANDBOX_DIR=~/sandbox
SANDBOX_DIR=/usr/local/sandbox
HOME_DIR=${HOME}/.platinumarts

#SANDBOX_OPTIONS="-r"
SANDBOX_OPTIONS="-q${HOME_DIR} -r"
#The -k's add two folders in the user's home as package dirs, just so he can make replacements for the contents on his side, easier

case $(uname -m) in
i386|i486|i586|i686)
  MACHINE_BIT=32
  ;;
*)
  MACHINE_BIT=64 #assume 64bit otherwise
  ;;
esac

if [ -x ${SANDBOX_DIR}/bin/sandbox_client_${MACHINE_BIT}_fps ]
then
	cd ${SANDBOX_DIR}
	exec ./bin/sandbox_client_${MACHINE_BIT}_fps ${SANDBOX_OPTIONS} $*
else
	echo "A problem was encountered, please check which of the following it is."
	echo "1) an executable does not exist for your architecture; $(uname -m)"
	echo "2) the executable was moved"
	echo "3) There isn't an executable"
	echo "4) There's an executable present, but has incorrect permissions (needs rwxr-xr-x or similar)"
	exit 1
fi
