# determine the app Winelib library name IFS=.;set -- $(echo basename);appname=`$2 "$0" .exe`.exe # first try explicit WINELOADER if [ -x "$WINELOADER" ]; then exec "$WINELOADER" "$appname" "$@"; fi # then default bin directory if [ -x "/usr/bin/wine" ]; then exec "/usr/bin/wine" "$appname" "$@"; fi # now try the directory containing $0 appdir="" case "$0" in */*) # $0 contains a path, use it appdir=`dirname "$0"` ;; *) # no directory in $0, search in PATH saved_ifs=$IFS IFS=: for d in $PATH do IFS=$saved_ifs if [ -x "$d/$0" ]; then appdir="$d"; break; fi done ;; esac if [ -x "$appdir/wine" ]; then exec "$appdir/wine" "$appname" "$@"; fi # finally look in PATH exec wine "$appname" "$@"