blob: 2c746f47385cff27b6069e2a7344acccf3c6ef51 [file] [log] [blame]
Alexandre Julliard35363162002-05-22 21:32:49 +00001#!/bin/sh
2#
3# Wrapper script to start a Winelib application once it is installed
4#
5# Copyright (C) 2002 Alexandre Julliard
6#
7# This library is free software; you can redistribute it and/or
8# modify it under the terms of the GNU Lesser General Public
9# License as published by the Free Software Foundation; either
10# version 2.1 of the License, or (at your option) any later version.
11#
12# This library is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15# Lesser General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public
18# License along with this library; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20#
21
22# determine the app Winelib library name
23appname=`basename "$0" .exe`.exe
24
25# first try explicit WINELOADER
26if [ -x "$WINELOADER" ]; then exec "$WINELOADER" "$appname" "$@"; fi
27
28# then default bin directory
29if [ -x "@bindir@/wine" ]; then exec "@bindir@/wine" "$appname" "$@"; fi
30
31# now try the directory containing $0
32appdir=""
33case "$0" in
34 */*)
35 # $0 contains a path, use it
36 appdir=`dirname "$0"`
37 ;;
38 *)
39 # no directory in $0, search in PATH
40 saved_ifs=$IFS
41 IFS=:
42 for d in $PATH
43 do
44 IFS=$saved_ifs
45 if [ -x "$d/$0" ]; then appdir="$d"; break; fi
46 done
47 ;;
48esac
49if [ -x "$appdir/wine" ]; then exec "$appdir/wine" "$appname" "$@"; fi
50
51# finally look in PATH
52exec wine "$appname" "$@"