mirror of
https://github.com/the-sane/lug-helper.git
synced 2025-01-13 16:40:35 +00:00
Simplify bundled file search
This commit is contained in:
parent
133ac19a3a
commit
89a9f444e0
@ -154,50 +154,41 @@ shaders_subdirs=(
|
|||||||
|
|
||||||
rsi_icon_name="rsi-launcher.png"
|
rsi_icon_name="rsi-launcher.png"
|
||||||
wine_launch_script_name="sc-launch.sh"
|
wine_launch_script_name="sc-launch.sh"
|
||||||
|
lug_logo="info"
|
||||||
|
|
||||||
# Read paths from XDG_DATA_DIRS into an array
|
# Build our array of search paths, supporting packaged versions of this script
|
||||||
IFS=':' read -r -a data_dirs_array <<< "$XDG_DATA_DIRS"
|
# Search XDG_DATA_DIRS and fall back to /usr/share/
|
||||||
|
|
||||||
# Check for files installed by a packaged version of this script
|
|
||||||
# Attempt to use XDG_DATA_DIRS with a fallback to /usr/share/
|
|
||||||
# Prefer files in the Helper directory for downloads from git
|
# Prefer files in the Helper directory for downloads from git
|
||||||
for (( i=0; i<"${#data_dirs_array[@]}"; i++ )); do
|
IFS=':' read -r -a data_dirs_array <<< "$helper_dir:$XDG_DATA_DIRS:/usr/share/"
|
||||||
# /usr/share/icons/hicolor/256x256/apps/lug-logo.png
|
|
||||||
if [ -f "$helper_dir/lug-logo.png" ]; then
|
# Locate our files in the search array
|
||||||
lug_logo="$helper_dir/lug-logo.png"
|
for searchdir in "${data_dirs_array[@]}"; do
|
||||||
elif [ -f "${data_dirs_array[i]}/icons/hicolor/256x256/apps/lug-logo.png" ]; then
|
# lug-logo.png
|
||||||
lug_logo="${data_dirs_array[i]}/icons/hicolor/256x256/apps/lug-logo.png"
|
if [ -f "$searchdir/lug-logo.png" ]; then
|
||||||
elif [ -f "/usr/share/icons/hicolor/256x256/apps/lug-logo.png" ]; then
|
lug_logo="$searchdir/lug-logo.png"
|
||||||
lug_logo="/usr/share/icons/hicolor/256x256/apps/lug-logo.png"
|
elif [ -f "$searchdir/icons/hicolor/256x256/apps/lug-logo.png" ]; then
|
||||||
else
|
lug_logo="$searchdir/icons/hicolor/256x256/apps/lug-logo.png"
|
||||||
lug_logo="info"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# /usr/share/icons/hicolor/256x256/apps/rsi-launcher.png
|
# rsi-launcher.png
|
||||||
if [ -f "$helper_dir/$rsi_icon_name" ]; then
|
if [ -f "$searchdir/$rsi_icon_name" ]; then
|
||||||
rsi_icon="$helper_dir/$rsi_icon_name"
|
rsi_icon="$searchdir/$rsi_icon_name"
|
||||||
elif [ -f "${data_dirs_array[i]}/icons/hicolor/256x256/apps/$rsi_icon_name" ]; then
|
elif [ -f "$searchdir/icons/hicolor/256x256/apps/$rsi_icon_name" ]; then
|
||||||
rsi_icon="${data_dirs_array[i]}/icons/hicolor/256x256/apps/$rsi_icon_name"
|
rsi_icon="$searchdir/icons/hicolor/256x256/apps/$rsi_icon_name"
|
||||||
else
|
|
||||||
rsi_icon="/usr/share/icons/hicolor/256x256/apps/$rsi_icon_name"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# /usr/share/lug-helper/lutris-starcitizen.json
|
# lutris-starcitizen.json
|
||||||
if [ -f "$helper_dir/lib/lutris-starcitizen.json" ]; then
|
if [ -f "$searchdir/lib/lutris-starcitizen.json" ]; then
|
||||||
lutris_install_script="$helper_dir/lib/lutris-starcitizen.json"
|
lutris_install_script="$searchdir/lib/lutris-starcitizen.json"
|
||||||
elif [ -f "${data_dirs_array[i]}/lug-helper/lutris-starcitizen.json" ]; then
|
elif [ -f "$searchdir/lug-helper/lutris-starcitizen.json" ]; then
|
||||||
lutris_install_script="${data_dirs_array[i]}/lug-helper/lutris-starcitizen.json"
|
lutris_install_script="$searchdir/lug-helper/lutris-starcitizen.json"
|
||||||
else
|
|
||||||
lutris_install_script="/usr/share/lug-helper/lutris-starcitizen.json"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# /usr/share/lug-helper/sc-launch.sh
|
# sc-launch.sh
|
||||||
if [ -f "$helper_dir/lib/$wine_launch_script_name" ]; then
|
if [ -f "$searchdir/lib/$wine_launch_script_name" ]; then
|
||||||
wine_launch_script="$helper_dir/lib/$wine_launch_script_name"
|
wine_launch_script="$searchdir/lib/$wine_launch_script_name"
|
||||||
elif [ -f "${data_dirs_array[i]}/lug-helper/$wine_launch_script_name" ]; then
|
elif [ -f "$searchdir/lug-helper/$wine_launch_script_name" ]; then
|
||||||
wine_launch_script="${data_dirs_array[i]}/lug-helper/$wine_launch_script_name"
|
wine_launch_script="$searchdir/lug-helper/$wine_launch_script_name"
|
||||||
else
|
|
||||||
wine_launch_script="/usr/share/lug-helper/$wine_launch_script_name"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user