From 3f9fc97de71d4666c488b08c04cda6681de289d8 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Sun, 28 Jul 2019 10:04:36 +0200 Subject: [PATCH] tools: export.sh: fix ESP-IDF path detection on macos The argument passed to the function is in $1; $0 contains `-bash`. Before this fix, IDF_PATH would be set to $PWD instead of the correct path. --- export.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/export.sh b/export.sh index 9f8f98f5a..0408a76bb 100644 --- a/export.sh +++ b/export.sh @@ -2,9 +2,10 @@ function realpath_int() { wdir="$PWD"; [ "$PWD" = "/" ] && wdir="" - case "$0" in - /*) scriptdir="${0}";; - *) scriptdir="$wdir/${0#./}";; + arg=$1 + case "$arg" in + /*) scriptdir="${arg}";; + *) scriptdir="$wdir/${arg#./}";; esac scriptdir="${scriptdir%/*}" echo "$scriptdir"