mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-11 14:51:49 +00:00
Support deduction of nvm directory in zsh
In zsh nvm fails to deduce nvm's directory from nvm.sh, because `$BASH_SOURCE` is not present in zsh. Use nvm.sh paths if either `$BASH_SOURCE` or `$0` is present.
This commit is contained in:
parent
0d44ed1126
commit
28abdf4924
2
nvm.sh
2
nvm.sh
@ -19,7 +19,7 @@ fi
|
|||||||
|
|
||||||
# Auto detect the NVM_DIR
|
# Auto detect the NVM_DIR
|
||||||
if [ ! -d "$NVM_DIR" ]; then
|
if [ ! -d "$NVM_DIR" ]; then
|
||||||
if [ -n "$BASH_SOURCE" ]; then
|
if [ -n "${BASH_SOURCE[0]:-$0}" ]; then
|
||||||
export NVM_DIR=$(cd $NVM_CD_FLAGS $(dirname ${BASH_SOURCE[0]:-$0}) > /dev/null && pwd)
|
export NVM_DIR=$(cd $NVM_CD_FLAGS $(dirname ${BASH_SOURCE[0]:-$0}) > /dev/null && pwd)
|
||||||
else
|
else
|
||||||
export NVM_DIR=$HOME/.nvm
|
export NVM_DIR=$HOME/.nvm
|
||||||
|
Loading…
Reference in New Issue
Block a user