package/environment-setup/environment-setup: add zsh
environment-setup uses BASH_SOURCE which is bash specific. For other shells, this variable is empty, leading to an error message and empty SDK_PATH. Zsh Uses $0. Unfortunately POSIX is not specifying how exactly $0 should behave when in sourced (or using special dot utility). So other shell support have to be implemented in different manner. Signed-off-by: Krzysztof Kanas <kkanas@fastmail.com> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> (cherry picked from commit 65cee90cc3cec4da11987370ea2de35d32f046b5) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
committed by
Peter Korsgaard
parent
421226cbe0
commit
79b4de9f27
@@ -16,4 +16,10 @@ Some tips:
|
|||||||
* To build CMake-based projects, use the "cmake" alias
|
* To build CMake-based projects, use the "cmake" alias
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
SDK_PATH=$(dirname $(realpath "${BASH_SOURCE[0]}"))
|
if [ x"$BASH_VERSION" != x"" ] ; then
|
||||||
|
SDK_PATH=$(dirname $(realpath "${BASH_SOURCE[0]}"))
|
||||||
|
elif [ x"$ZSH_VERSION" != x"" ] ; then
|
||||||
|
SDK_PATH=$(dirname $(realpath $0))
|
||||||
|
else
|
||||||
|
echo "unsupported shell"
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user