mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-29 16:24:16 +00:00
scripts: flatpak: respect XDG data home in launcher script, add Steam Flatpak data directory
This commit is contained in:
parent
fccf044976
commit
11f3d97cd7
@ -1,24 +1,58 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
die()
|
||||||
|
{
|
||||||
|
echo "$@"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
echo "Xash3D FWGS installed as Flatpak."
|
echo "Xash3D FWGS installed as Flatpak."
|
||||||
|
|
||||||
export XASH3D_BASEDIR="$HOME/.xash/"
|
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||||
mkdir -p $XASH3D_BASEDIR
|
# $XDG_DATA_HOME defines the base directory relative to which user-specific data files should be stored.
|
||||||
cd $XASH3D_BASEDIR
|
# If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.
|
||||||
echo "Base directory is $XASH3D_BASEDIR"
|
if [ -z "$XDG_DATA_HOME" ]; then
|
||||||
|
export XDG_DATA_HOME="$HOME/.local/share"
|
||||||
|
fi
|
||||||
|
|
||||||
# TODO: detect by libraryfolders.vdf and installed apps
|
if [ -z "$XASH3D_BASEDIR" ]; then
|
||||||
HALFLIFESTEAMDIRS="../.local/share/Steam/steamapps/common/Half-Life ../.steam/steam/steamapps/common/Half-Life"
|
export XASH3D_BASEDIR="$XDG_DATA_HOME/xash3d-fwgs/"
|
||||||
|
fi
|
||||||
|
|
||||||
for i in $HALFLIFESTEAMDIRS; do
|
mkdir -p "$XASH3D_BASEDIR"
|
||||||
# echo $i
|
cd "$XASH3D_BASEDIR" || die "Can't cd into $XASH3D_BASEDIR"
|
||||||
if [ -d "$i" ]; then
|
echo "XASH3D_BASEDIR is $XASH3D_BASEDIR"
|
||||||
echo "Detected Half-Life installation in $i, using as RoDir"
|
|
||||||
export XASH3D_RODIR=$i
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
|
if [ -z "$XASH3D_RODIR" ]; then
|
||||||
|
# TODO: detect by libraryfolders.vdf and installed apps
|
||||||
|
STEAMDIRS="\
|
||||||
|
$HOME/.local/share/Steam/steamapps/common/ \
|
||||||
|
$HOME/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamapps/common \
|
||||||
|
$HOME/.steam/steam/steamapps/common"
|
||||||
|
HALFLIFEDIR="Half-Life"
|
||||||
|
|
||||||
|
for i in $STEAMDIRS; do
|
||||||
|
if [ ! -d "$i" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Detected Steam library in $i, probing Half-Life..."
|
||||||
|
|
||||||
|
if [ ! -d "$i$HALFLIFEDIR" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Detected Half-Life installation in $i$HALFLIFEDIR..."
|
||||||
|
|
||||||
|
export XASH3D_RODIR="$i$HALFLIFEDIR"
|
||||||
|
break
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
echo "XASH3D_RODIR is $XASH3D_RODIR"
|
||||||
|
|
||||||
|
if [ -z "$XASH3D_EXTRAS_PAK1" ]; then
|
||||||
|
export XASH3D_EXTRAS_PAK1=/app/share/xash3d/valve/extras.pk3
|
||||||
|
fi
|
||||||
|
echo "XASH3D_EXTRAS_PAK1 is $XASH3D_EXTRAS_PAK1"
|
||||||
|
|
||||||
export XASH3D_EXTRAS_PAK1=/app/share/xash3d/valve/extras.pk3
|
|
||||||
exec $DEBUGGER /app/lib32/xash3d/xash3d "$@"
|
exec $DEBUGGER /app/lib32/xash3d/xash3d "$@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user