#!/bin/sh
#
# Original author: Aaron Voisine <aaron@voisine.org>
# pvQT modifications: Harry van der Wolf <harryvanderwolf@home.nl>

CWD="`dirname \"$0\"`"
BASE="`echo "$0" | sed -e 's/\/Contents\/Resources\/script/\//'`"
cd "$BASE"

CWD="`(cd \"\`dirname \\\"$0\\\"\`\"; echo $PWD)`"

export DYLD_FRAMEWORK_PATH="$CWD/../Frameworks"
export PATH="$CWD:$CWD/../MacOS:$PATH"


# TODO: Have to add ".UTF-8" to the LANG since ommiting causes avidemux
#       to crash on startup in locale_from_utf8().
export LANG="`grep \"\`defaults read .GlobalPreferences AppleCollationOrder \
        2>&1\`_\" /usr/share/locale/locale.alias | tail -n1 | sed 's/\./ /' | \
        awk '{print $2}'`.UTF-8"

if [ $# -lt 2 ];
then
    $CWD/../MacOS/PTBG
else
    $CWD/../MacOS/PTBG "$@"
fi

