From d67b422a7dbd65cc92e5302d89578225d8f1f5c0 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 24 Jun 2023 18:36:38 -0400 Subject: [PATCH] Hopefully better error handling for download errors and missing game files. --- audiogame-manager.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/audiogame-manager.sh b/audiogame-manager.sh index 337f4ec..f9ba389 100755 --- a/audiogame-manager.sh +++ b/audiogame-manager.sh @@ -286,7 +286,17 @@ download() { # Skip if the item is in cache. test -e "${cache}/${dest}" && continue if ! curl -L4 -C - --retry 10 --output "${cache}/${dest}" "${i}" ; then - echo "Could not download \"$i\"..." + local exit_code="$?" + if [[ $exit_code -eq 22 ]]; then + echo "File not found: \"$i\" (HTTP 404)" + # Remove the empty file. + rm -f "${cache}/${dest}" + exit 1 + fi + fi + if file -b "${cache}/${dest}" | grep -q "HTML document" ; then + echo "File not found: \"$i\" (HTML document probably 404)" + rm -f "${cache}/${dest}" exit 1 fi done @@ -1749,9 +1759,9 @@ download "https://erion.cf/files/ag_103.zip" add_launcher "c:\Program Files\blind-drive\Blind Drive.exe" ;; "Bloodshed") + download "http://www.samtupy.com/games/bloodshed.exe" export winVer="win7" install_wine_bottle speechsdk - download "http://www.samtupy.com/games/bloodshed.exe" cp "${cache}/bloodshed.exe" "$WINEPREFIX/drive_c/Program Files/" add_launcher "c:\Program Files\bloodshed.exe" ;;