#!/bin/bash
COLLECTS=$1

# Some of the staapl modules require staapl to be installed in the
# collects dir. By default, link the staapl dir into the user's local
# collects.

# Query mzscheme for user's collects dir.
if [ -z "$COLLECTS" ]; then
    COLLECTS=`mzscheme --eval '(require setup/dirs)(display (path->string (find-user-collects-dir)))'`
fi

# It might not exist yet..
mkdir -p $COLLECTS

# Remove old link and install new one.
THERE=$COLLECTS/staapl
rm -f $THERE
CMD="ln -sf `pwd`/staapl $THERE"
echo "installed Staapl in $THERE"
$CMD
