Improved file check code. Added detection for if a wad file fails to download.

This commit is contained in:
Storm Dragon 2024-09-14 03:03:30 -04:00
parent 7d5e132f91
commit f50b025334

View File

@ -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
}