#!/bin/sh
#
# stc startup script 
#

APP_NAME=stc

# imagine we startup in current directory as the script
parentdir=${0%/*}
cd $parentdir

# here is where we look for the software
# desktop has priority
p1=$HOME/Desktop/$APP_NAME.app/Contents/MacOS/$APP_NAME
p2=$HOME/Desktop/$APP_NAME/$APP_NAME
#
# then check /Applications or /Applications/bdslab
p3=/Applications/$APP_NAME.app/Contents/MacOS/$APP_NAME
p4=/Applications/bdslab/$APP_NAME.app/Contents/MacOS/$APP_NAME
#
# check /usr/local or /usr/local/bdslab
p5=/usr/local/$APP_NAME/$APP_NAME
p6=/usr/local/bdslab/$APP_NAME/$APP_NAME

# stop when we have found an executable
APP_LIST="$p1 $p2 $p3 $p4 $p5 $p6"
prog=""
for i in $APP_LIST; do
	if ( test -x $i ) then
		prog=$i
		break
	fi
done

if ( test -x $prog) then
	# start program 
	$prog &
else
	# did not find software
	echo "Cannot find $APP_NAME executable on this machine."
fi
exit
