From 5c6663237e7fa052f3caccc9de260238e928aa73 Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Wed, 11 May 2022 13:12:32 +0000 Subject: [PATCH] config/functions: improve error message when there in not a device directory --- config/functions | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/config/functions b/config/functions index 7166bb8086..f98e76739c 100644 --- a/config/functions +++ b/config/functions @@ -767,8 +767,15 @@ check_project() { check_device() { local dashes="===========================" device_err_msg - if [ \( -z "${DEVICE}" -a -d "${PROJECT_DIR}/${PROJECT}/devices" \) -o \ - \( -n "${DEVICE}" -a ! -d "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}" \) ]; then + if [ -n "${DEVICE}" -a ! -d "${PROJECT_DIR}/${PROJECT}/devices" ]; then + device_err_msg="\n $dashes$dashes$dashes" + device_err_msg+="\n ERROR: You must not specify DEVICE for the $PROJECT project" + device_err_msg+="\n $dashes$dashes$dashes" + device_err_msg+="\n\n There are no devices for project: ${PROJECT}" + + die "${device_err_msg}" + elif [ \( -z "${DEVICE}" -a -d "${PROJECT_DIR}/${PROJECT}/devices" \) -o \ + \( -n "${DEVICE}" -a ! -d "${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}" \) ]; then device_err_msg="\n ${dashes}${dashes}${dashes}" device_err_msg+="\n ERROR: Specify a valid device for the ${PROJECT} project" device_err_msg+="\n ${dashes}${dashes}${dashes}"