#!/bin/ksh
#  This program should be in the Isight install's examples/development/applications directory.
# run application development examples

if (($# < 1)) 
then
	print 'Usage: runExample [example name]'
	exit 1
fi

# set the logical directory as if we were run from FIPER_HOME/code/command prior to
# sourcing fiperenv.  if you are compiling or running the examples outside of the
# FIPER_HOME/examples directory you will need to modify the following line to point
# to where FIPER_HOME is installed 
# ---- OR ----
#
if [ "$FIPER_HOME" = "" ]; then
    # this assumes that this examples directory is within the FIPER_HOME/examples directory structure
	dir=`cd "../../../code/command"; /bin/pwd`
else 
    # this allows to user to copy the examples directory to a new location, provided they supply
    # the correct value for FIPER_HOME
	dir=`cd "$FIPER_HOME/code/command"; /bin/pwd`
fi

# sets FIPER_HOME (assuming $dir points to the FIPER_HOME/code/command directory)
. "$dir/fiperenv"

if [ ! -f $FIPER_HOME/docs/java/SMAFIPsdk.jar ]; then
    echo "The environment variable FIPER_HOME must point to an Isight installation"
    echo "Either unset the variable or set it to point to the correct directory"
    exit 1
fi

. "$dir/fiperenv"


clspath="SMAFIPdev-visual-util.jar:SMAFIPdashboard.jar:SMAFIPfrapi.jar:SMAFIPvdd.jar:SMAFIPmdolTranslator.jar:SMAFIPgateway.jar:rsyntaxtextarea.jar:autocomplete.jar:ModalFrameUtil.jar:${FiperJars}:$FIPER_HOME"
pgm="examples.development.applications.$1"
extraparms=""

# "shift" keeps the first argument from being repeated by the launch script, which concatenates all arguments onto the end of the call to java
shift

. "$FIPER_HOME/code/command/launch"
