summarylogtreecommitdiffstats
path: root/launcher
blob: 62ffacbeef1dd2c9f4dfd7764b7f0609abe47325 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

lang=""

_lang() {
  local uage="${LANG%%.*}"
  lang="${uage%%_*}"
}

_launch() {
  lang="${1}"
  [ -z "${lang}" ] && _lang
  local _game="/usr/games/%app_id%"
  local _path=$(cat "${_game}/${lang}" 2>/dev/null) 
  if [ ! -f "${_game}/${lang}" ]; then
    echo "No support for language '${lang}'"
    echo "Install %pkgbase%-${lang}"
    echo "Running default language"
    _path=$(cat "${_game}/any")
  fi

  duckstation-nogui -fullscreen "${_path}"
}

_main() {
  if [[ "${1}" == "--help" ]]; then
    echo "HELP: %pkgbase% <language>"
  else
    game_lang="${1}"
    _launch "${game_lang}"
  fi
}


_main "$@"