#!/bin/bash

# Stolen from http://stackoverflow.com/a/246128/292831
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# export PATH with DIR so we add the binary folder to PATH (for desura_bittest calls)
export PATH="$DIR:$PATH"

if [[ "../lib/desurium" = /* ]]; then
	export LD_LIBRARY_PATH="../lib/desurium/"
	# also add our runtime lib directory to path
	export PATH="$LD_LIBRARY_PATH:$PATH"
	../lib/desurium/mcf_util $@
else
	export LD_LIBRARY_PATH="$DIR/../lib/desurium/"
	# also add our runtime lib directory to path
	export PATH="$LD_LIBRARY_PATH:$PATH"
	$DIR/../lib/desurium/mcf_util $@
fi

