]> granicus.if.org Git - esp-idf/commitdiff
tools: export.sh: fix ESP-IDF path detection on macos
authorIvan Grokhotkov <ivan@espressif.com>
Sun, 28 Jul 2019 08:04:36 +0000 (10:04 +0200)
committerIvan Grokhotkov <ivan@espressif.com>
Sun, 28 Jul 2019 08:04:36 +0000 (10:04 +0200)
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

index 9f8f98f5aa525fb260b23f59fa38225f4955731f..0408a76bb3d1f218b4dc5277685f2581ab0611d7 100644 (file)
--- 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"