mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-11 06:41:50 +00:00
[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
ea3b65f02e
commit
9222739d18
6
nvm.sh
6
nvm.sh
@ -407,6 +407,12 @@ nvm_tree_contains_path() {
|
|||||||
previous_pathdir="${node_path}"
|
previous_pathdir="${node_path}"
|
||||||
local pathdir
|
local pathdir
|
||||||
pathdir=$(dirname "${previous_pathdir}")
|
pathdir=$(dirname "${previous_pathdir}")
|
||||||
|
|
||||||
|
# get real directory in case of symbolic links
|
||||||
|
if [ -d "${pathdir-}" ]; then
|
||||||
|
pathdir="$(nvm_cd -P "${pathdir}" && pwd)"
|
||||||
|
fi
|
||||||
|
|
||||||
while [ "${pathdir}" != '' ] && [ "${pathdir}" != '.' ] && [ "${pathdir}" != '/' ] &&
|
while [ "${pathdir}" != '' ] && [ "${pathdir}" != '.' ] && [ "${pathdir}" != '/' ] &&
|
||||||
[ "${pathdir}" != "${tree}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
|
[ "${pathdir}" != "${tree}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
|
||||||
previous_pathdir="${pathdir}"
|
previous_pathdir="${pathdir}"
|
||||||
|
Loading…
Reference in New Issue
Block a user