[Fix] `nvm_tree_contains_path`: handle symbolic links
Co-Authored-By: Charlie Hileman <aiquicorp@gmail.com> Co-Authored-By: Jordan Harband <ljharb@gmail.com>
This commit is contained in:
parent
a1ad32e9cb
commit
ab7b4daf17
6
nvm.sh
6
nvm.sh
|
|
@ -311,6 +311,12 @@ nvm_tree_contains_path() {
|
|||
|
||||
local pathdir
|
||||
pathdir=$(dirname "${node_path}")
|
||||
|
||||
# get real directory in case of symbolic links
|
||||
if [ -d "${pathdir-}" ]; then
|
||||
pathdir="$(nvm_cd -P "${pathdir}" && pwd)"
|
||||
fi
|
||||
|
||||
while [ "${pathdir}" != "" ] && [ "${pathdir}" != "." ] && [ "${pathdir}" != "/" ] && [ "${pathdir}" != "${tree}" ]; do
|
||||
pathdir=$(dirname "${pathdir}")
|
||||
done
|
||||
|
|
|
|||
Loading…
Reference in New Issue