#!/bin/sh

BASE=../../../../generated/tests/libbe_test/x86/apps

if [ ! -f $BASE/test_app_server ]; then
	echo "You need to \"TARGET_PLATFORM=libbe_test jam install-test-apps\" first."
	exit
fi

# launch registrar
$BASE/run_test_registrar || exit

# launch app_server
$BASE/test_app_server &

if [ "$#" -eq 0 ]; then
	# no argument given, don't start any apps
	exit
elif [ "$1" = "-o" ]; then
	open $BASE
	shift
fi

sleep 1

for i in $@; do
	$BASE/$i &
done
