#!/bin/sh

# Keep in ~sync with ooo-wrapper

SystemInstallDir="/usr/lib/ooo-2.0"

if [ -n "$GNOME_DESKTOP_SESSION_ID" -a -d "$SystemInstallDir/program/resource.gnome" ]; then
    icon_set="gnome"
elif [ -n "$KDE_FULL_SESSION" -a -d "$SystemInstallDir/program/resource.kde" ]; then
    icon_set="kde"
fi

if [ -z "$icon_set" ]; then
    if [ -d "$SystemInstallDir/program/resource.default" ]; then
	icon_set="default"
    elif [ -d "$SystemInstallDir/program/resource.kde" ]; then
	icon_set="kde"
    elif [ -d "$SystemInstallDir/program/resource.gnome" ]; then
	icon_set="gnome"
    else
	icon_set="default"
    fi
fi
    
if [ -d "$SystemInstallDir/program/resource.$icon_set" ]; then
    OOO_PREFERRED_RESOURCE_PATH="$SystemInstallDir/program/resource.$icon_set"
    export OOO_PREFERRED_RESOURCE_PATH
fi

exec "/usr/lib/ooo-2.0/program/jvmsetup" "$@"
