mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
converted tree path to canonical form for case-insensitive comp
This commit is contained in:
parent
811c039e2b
commit
6375e4ed79
12
nvm.sh
12
nvm.sh
@ -417,6 +417,7 @@ else
|
||||
fi
|
||||
unset NVM_SCRIPT_SOURCE 2>/dev/null
|
||||
|
||||
|
||||
nvm_tree_contains_path() {
|
||||
local tree
|
||||
tree="${1-}"
|
||||
@ -432,14 +433,21 @@ nvm_tree_contains_path() {
|
||||
previous_pathdir="${node_path}"
|
||||
local pathdir
|
||||
pathdir=$(dirname "${previous_pathdir}")
|
||||
|
||||
# Convert tree path to canonical form for case-insensitive comparison
|
||||
local tree_canonical
|
||||
tree_canonical=$(cd "${tree}" && pwd -P)
|
||||
|
||||
while [ "${pathdir}" != '' ] && [ "${pathdir}" != '.' ] && [ "${pathdir}" != '/' ] &&
|
||||
[ "${pathdir}" != "${tree}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
|
||||
[ "${pathdir}" != "${tree_canonical}" ] && [ "${pathdir}" != "${previous_pathdir}" ]; do
|
||||
previous_pathdir="${pathdir}"
|
||||
pathdir=$(dirname "${previous_pathdir}")
|
||||
done
|
||||
[ "${pathdir}" = "${tree}" ]
|
||||
|
||||
[ "${pathdir}" = "${tree_canonical}" ]
|
||||
}
|
||||
|
||||
|
||||
nvm_find_project_dir() {
|
||||
local path_
|
||||
path_="${PWD}"
|
||||
|
Loading…
Reference in New Issue
Block a user