From f50b025334ac701ab7539802dcfb13c0a8e3b762 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 14 Sep 2024 03:03:30 -0400 Subject: [PATCH] Improved file check code. Added detection for if a wad file fails to download. --- linux-game-manager.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/linux-game-manager.sh b/linux-game-manager.sh index 822cddf..90f590e 100755 --- a/linux-game-manager.sh +++ b/linux-game-manager.sh @@ -204,17 +204,26 @@ download() { echo "Could not download \"$i\"..." exit 1 fi + local downloadError=1 case "${dest##*.}" in - "zip") + "pk3"|"zip") if [[ "$(file -b --mime-type "${cache}/${dest}")" != "application/zip" ]]; then - rm -fv "${cache}/${dest}" + downloadError=0 + fi + ;; + "wad") + if [[ "$(file -b --mime-type "${cache}/${dest}")" != "application/octet-stream" ]]; then + downloadError=0 + fi + ;; + esac + if [[ $downloadError -eq 0 ]]; then + rm -fv "${cache}/${dest}" dialog --backtitle "Linux Game Manager" \ --infobox "Error downloading \"${dest}\". Installation cannot continue." -1 -1 --stdout alert exit 1 - fi - ;; - esac + fi done }