wineapploader.in 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  20. #
  21. # determine the app Winelib library name
  22. appname=`basename "$0" .exe`.exe
  23. # first try explicit WINELOADER
  24. if [ -x "$WINELOADER" ]; then exec "$WINELOADER" "$appname" "$@"; fi
  25. # now try the directory containing $0
  26. appdir=""
  27. case "$0" in
  28. */*)
  29. # $0 contains a path, use it
  30. appdir=`dirname "$0"`
  31. ;;
  32. *)
  33. # no directory in $0, search in PATH
  34. saved_ifs=$IFS
  35. IFS=:
  36. for d in $PATH
  37. do
  38. IFS=$saved_ifs
  39. if [ -x "$d/$0" ]; then appdir="$d"; break; fi
  40. done
  41. ;;
  42. esac
  43. if [ -x "$appdir/wine" ]; then exec "$appdir/wine" "$appname" "$@"; fi
  44. if [ -x "$appdir/wine64" ]; then exec "$appdir/wine64" "$appname" "$@"; fi
  45. # now look in PATH
  46. saved_ifs=$IFS
  47. IFS=:
  48. for d in $PATH
  49. do
  50. IFS=$saved_ifs
  51. if [ -x "$d/wine" ]; then exec "$d/wine" "$appname" "$@"; fi
  52. if [ -x "$d/wine64" ]; then exec "$d/wine64" "$appname" "$@"; fi
  53. done
  54. # finally, the default bin directory
  55. if [ -x "@bindir@/wine" ]; then exec "@bindir@/wine" "$appname" "$@"; fi
  56. if [ -x "@bindir@/wine64" ]; then exec "@bindir@/wine64" "$appname" "$@"; fi
  57. echo "$0: the Wine loader is missing"
  58. exit 1