#!/bin/sh

# This script allows you to use PyClewn (Vim GDB integration) with walnut.

# get path of this script
BINDIR=`dirname "$0"`
SRCDIR=$BINDIR  # we assume this. We test lateron whether this

# we assume that your source dir is two or tree levels up. Setting the working directory to the source dir
# eases file browsing vim later
if [ -d "$BINDIR/../../src" ]; then
    SRCDIR="$BINDIR/../../src"
else
    if [ -d "$BINDIR/../../../src" ]; then
        SRCDIR="$BINDIR/../../../src"
    else
        echo "Could not find source dir." # this is not really critical.
    fi
fi

# run walnut
pyclewn -c "-c \"cd $SRCDIR\"" -a $BINDIR/openwalnut-qt4 "$*"

