Comment out games with #// instead of just # at top of file.

This commit is contained in:
Storm Dragon
2026-02-21 16:31:06 -05:00
parent 9b454388f5
commit efc5f20b5b
2 changed files with 62 additions and 9 deletions

View File

@@ -455,8 +455,54 @@ clear_cache() {
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Cache deleted."
}
download_with_fallback() {
local outputPath="$1"
local sourceUrl="$2"
local firstExitCode=0
local secondExitCode=0
local thirdExitCode=0
local errorFile=""
downloadCurlExitCodes=""
downloadErrorLog=""
if ! errorFile="$(mktemp)"; then
return 1
fi
if curl -L4 -C - --retry 10 --output "${outputPath}" "${sourceUrl}" 2> "${errorFile}"; then
rm -f "${errorFile}"
return 0
fi
firstExitCode=$?
# Some hosts reject resume requests. Retry from scratch.
rm -f "${outputPath}"
if curl -L4 --retry 10 --output "${outputPath}" "${sourceUrl}" 2>> "${errorFile}"; then
rm -f "${errorFile}"
return 0
fi
secondExitCode=$?
# If IPv4-only fails, retry allowing either IP family.
rm -f "${outputPath}"
if curl -L --retry 10 --output "${outputPath}" "${sourceUrl}" 2>> "${errorFile}"; then
rm -f "${errorFile}"
return 0
fi
thirdExitCode=$?
downloadCurlExitCodes="${firstExitCode}, ${secondExitCode}, ${thirdExitCode}"
if cp -f "${errorFile}" "${cache}/curl-error.log" 2> /dev/null; then
downloadErrorLog="${cache}/curl-error.log"
rm -f "${errorFile}"
else
downloadErrorLog="${errorFile}"
fi
return 1
}
download() {
local source=($@)
local source=("$@")
for i in "${source[@]}" ; do
local dest="${i##*/}"
dest="${dest//%20/ }"
@@ -469,8 +515,8 @@ download() {
fi
# Skip if the item is in cache.
[[ -e "${cache}/${dest}" ]] && continue
{ if ! curl -L4 -C - --retry 10 --output "${cache}/${dest}" "${i}" ; then
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$i\"..."
{ if ! download_with_fallback "${cache}/${dest}" "${i}" ; then
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$i\"...\n\ncurl exit codes: ${downloadCurlExitCodes}\nError details: ${downloadErrorLog}"
exit 1
fi; } | ui_progressbox "Linux Game Manager" "Downloading \"$dest\" from \"$i\""
local downloadError=1
@@ -526,8 +572,8 @@ download_named() {
fi
# Skip if the item is in cache.
test -e "${cache}/${dest}" && return
if ! curl -L4 --output "${cache}/${dest}" "${2}" ; then
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$dest\"..."
if ! download_with_fallback "${cache}/${dest}" "${2}" ; then
ui_msgbox "Linux Game Manager" "Linux Game Manager" "Could not download \"$dest\"...\n\ncurl exit codes: ${downloadCurlExitCodes}\nError details: ${downloadErrorLog}"
exit 1
fi
}
@@ -597,10 +643,10 @@ help() {
game_installer() {
# Create the menu of available games by reading from .install directory
declare -a menuList
# Get all .sh files from .install directory, excluding those starting with #, and sort them
# Get all .sh files from .install directory, excluding those starting with #//, and sort them
mapfile -t sortedGames < <(for f in "${0%/*}/.install/"*.sh; do
# Skip if first line starts with #
[[ $(head -n1 "$f") == "#"* ]] && continue
# Skip if first line starts with #//
[[ $(head -n1 "$f") == "#//"* ]] && continue
# Output filename without .sh extension
echo "${f##*/}"
done | sort)
@@ -759,7 +805,7 @@ game_launcher() {
if [[ -d ".launch" ]]; then
find -L "${0%/*}/.launch" -maxdepth 1 -type f -iname "*.sh" -print0 | sort -z | xargs -0 bash -c '
for f; do
[[ $(head -n1 "$f") =~ ^#$ ]] && continue
[[ $(head -n1 "$f") == "#//"* ]] && continue
name="${f##*/}"
echo "$f"
echo "${name%.sh}"