From 345b44f06b67a1eedcfe9d02c1cb03da43d899cd Mon Sep 17 00:00:00 2001 From: Demyx Date: Thu, 7 Mar 2024 02:40:18 -0800 Subject: [PATCH] `find` found multiple paths matching the app's domain which was crashing `demyx restore` --- function/global.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/function/global.sh b/function/global.sh index b07e6bf..9f7566a 100644 --- a/function/global.sh +++ b/function/global.sh @@ -166,7 +166,14 @@ demyx_app_login() { demyx_app_path() { demyx_event local DEMYX_APP_PATH="${1:-$DEMYX_ARG_2}" - find "$DEMYX_APP" -name "$DEMYX_APP_PATH" -type d + local DEMYX_APP_PATH_FIND= + DEMYX_APP_PATH_FIND="$(find "$DEMYX_APP" -name "$DEMYX_APP_PATH" -type d)" + + if [[ "$DEMYX_APP_PATH_FIND" == *"$DEMYX_WP"/"$DEMYX_APP_PATH"* ]]; then + echo "$DEMYX_WP"/"$DEMYX_APP_PATH" + else + echo "$DEMYX_APP_PATH_FIND" + fi } # # Echo out protocol based on DEMYX_APP_SSL or DEMYX_APP_SSL_WILDCARD.