summarylogtreecommitdiffstats
path: root/discord-launcher.sh
blob: 6e6f47e3f947944ef56333a3abe76f2444da3fd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/bash

set -euo pipefail

name=@PKGNAME@
electron=@ELECTRON@
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf"

declare -a flags

if [[ -f "${flags_file}" ]]; then
    mapfile -t < "${flags_file}"
fi

for line in "${MAPFILE[@]}"; do
    if [[ ! "${line}" =~ ^[[:space:]]*#.* ]] && [[ -n "${line}" ]]; then
        flags+=("${line}")
    fi
done

exec /usr/bin/${electron} /usr/share/${name}/resources/app.asar "${flags[@]}" "$@"