#!/bin/sh 

BIOLEGATO_HOME=$BIRCH/java/bioLegato
export BIOLEGATO_HOME


# The location of anciliary data files used by bioLegato.
#BL_DATA_DIR=$BIRCH/dat/bldna.new
BL_DATA_DIR=$BIRCH/dat/blpcd
export BL_DATA_DIR


BL_PROPERTIES=$BL_DATA_DIR/blpcd.properties
export BL_PROPERTIES

# The -dir switch is mainly for launching bioLegato from the birch launcher. By 
# prompting the user for a working folder, we help enforce good file organization
# habits.
if [ $# -gt 0 ]
then
   if [ ${1} = "-dir" ]
   then

      # Get rid of the -dir switch, and send the remaining command line arguments to bioLegato
      shift

      #Prompt the user to choose a working directory
      CHANGEDIR=`java -cp "$BIRCH/script" DirChooser "Where do you want to work? Choose a folder."`

      if [ -d "$CHANGEDIR" ]; then
	  cd "$CHANGEDIR"
      fi
   fi
fi


java -jar $BIOLEGATO_HOME/biopcdedit.jar $*

# ------------------------ LOGGING ------------------------------
# Check to see if we can log when GDE is launched.
# If BIRCH is mounted read only, we don't crash the script

if [ "$BIRCH_LOGGING" -eq "1" ] 
    then
    echo `whoami` `date` >> $BIRCH/local/admin/biolegato.log
fi

