From 841807afe6c685570dc08b276accad1281f6c080 Mon Sep 17 00:00:00 2001 From: Liam <33645555+lj3954@users.noreply.github.com> Date: Sat, 25 Nov 2023 17:39:10 -0800 Subject: [PATCH] Fix show-iso-url and test-iso-url creating unnecessary directories --- quickget | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/quickget b/quickget index bdb8511..4fcb713 100755 --- a/quickget +++ b/quickget @@ -925,11 +925,6 @@ function web_get() { FILE="${URL##*/}" fi - if ! mkdir -p "${DIR}" 2>/dev/null; then - echo "ERROR! Unable to create directory ${DIR}" - exit 1 - fi - # Test mode for ISO if [ "${show_iso_url}" == 'on' ]; then echo "${URL}" @@ -937,7 +932,14 @@ function web_get() { elif [ "${test_iso_url}" == 'on' ]; then wget --spider "${URL}" exit 0 - elif command -v aria2c &>/dev/null; then + fi + + if ! mkdir -p "${DIR}" 2>/dev/null; then + echo "ERROR! Unable to create directory ${DIR}" + exit 1 + fi + + if command -v aria2c &>/dev/null; then if ! aria2c --stderr -x16 --continue=true --summary-interval=0 --download-result=hide --console-log-level=error "${URL}" --dir "${DIR}" -o "${FILE}"; then echo #Necessary as aria2c in suppressed mode does not have new lines echo "ERROR! Failed to download ${URL} with aria2c. Try running 'quickget' again."