#!/bin/bash

RADIANT_HOME=$(dirname "$0")
RADIANT_HOME=${RADIANT_HOME/NetRadiant.app*/NetRadiant.app}

echo
echo "Starting NetRadiant in ${RADIANT_HOME}"
echo

set -x

resources="${RADIANT_HOME}/Contents/Resources"

export FONTCONFIG_PATH="${resources}/etc/fonts"
export FC_DEBUG=1024

export GDK_GL_LIBGL_PATH="${resources}/lib/libGL.1.dylib"
export GDK_GL_LIBGLU_PATH="${resources}/lib/libGLU.1.dylib"

export GDK_PATH="${resources}"
export GDK_PIXBUF_MODULE_FILE="${resources}/etc/gtk-2.0/gdk-pixbuf.loaders"

export GOBJECT_PATH="${resources}"

export GTK_DATA_PREFIX="${resources}"
export GTK_EXE_PREFIX="${resources}"
export GTK_PATH="${resources}"

export PANGO_SYSCONFDIR="${resources}/etc"
export PANGO_LIBDIR="${resources}/lib"

cd "${resources}/install"
./radiant.x86_64 &

set +x