mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-01 13:25:46 -04:00
dist/freedoom: support ~/.local installs, make it easier to read paths
Bunch of logic to use XDG_DATA_HOME or fallback according to the actual XDG recommendations. Use an array to build up paths (can be edited easily in the future or for whatever custom purpose), which shellcheck warned is a bash-ism, so change the script interpreter to bash as well. Let’s hope that doesn’t break anyone (does anyone lack bash even if they don’t use it as their shell?)
This commit is contained in:
parent
5a9483c329
commit
d9a1ff3e78
1 changed files with 20 additions and 2 deletions
22
dist/freedoom
vendored
22
dist/freedoom
vendored
|
@ -1,4 +1,4 @@
|
|||
#!/bin/sh -
|
||||
#!/bin/bash -
|
||||
|
||||
# These ports should really be ordered by ease-of-use. Most likely
|
||||
# advanced users with many ports installed will invoke their preferred
|
||||
|
@ -32,7 +32,25 @@ case "$(basename "$0")" in
|
|||
esac
|
||||
|
||||
if [ -z "$DOOMWADPATH" ]; then
|
||||
export DOOMWADPATH="/usr/share/doom:/usr/share/games/doom:/usr/local/share/doom:/usr/local/share/games/doom"
|
||||
# Support installations of Freedoom to the home directory using
|
||||
# the XDG spec. Makes this complicated, but let’s do it right.
|
||||
if [ -z "$XDG_DATA_HOME" ]; then
|
||||
if [ -z "$HOME" ]; then
|
||||
HOME=/
|
||||
fi
|
||||
XDG_PATH="$HOME"/.local/share/games/doom
|
||||
else
|
||||
XDG_PATH="$XDG_DATA_HOME"/games/doom
|
||||
fi
|
||||
|
||||
PATHS=(
|
||||
"$XDG_PATH"
|
||||
/usr/local/share/games/doom
|
||||
/usr/local/share/doom
|
||||
/usr/share/games/doom
|
||||
/usr/share/doom
|
||||
)
|
||||
export DOOMWADPATH="$(echo "${PATHS[@]}" | tr ' ' :)"
|
||||
fi
|
||||
|
||||
if [ -z "$DOOMPORT" ] && [ -h "$HOME"/.doomport ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue