#!/bin/sh
# Wrap script for search and run OOo in host system
# (c) Etersoft 2007, 2009
# Copyright 2007 Konstantin Kondratyuk
# Copyright 2007 Vitaly Lipatov
# FIXME: GUI warning, test with OOo from InfraResource

# do not translate URL
if echo "$1" | grep ".*://" >/dev/null ; then
    UNIXPATH="$1"
else
    UNIXPATH=`winepath "$1"`
fi

PLAYERLIST="ooffice loffice openoffice.org2.2 openoffice.org2.3 openoffice.org2.4 openoffice.org2.5 soffice"

for i in $PLAYERLIST ; do
	test -n "$OOFFICE" && break
	OOFFICE=`which $i 2>/dev/null`
done

test -z "$OOFFICE" && { echo "OpenOffice.org is not found on your system, check for ooffice executable in PATH" ; exit 1 ; }
$OOFFICE "$UNIXPATH"
