Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

converted tree path to canonical form for case-insensitive comparison, attempt to solve issue #1049 #3348

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ else
fi
unset NVM_SCRIPT_SOURCE 2>/dev/null


nvm_tree_contains_path() {
local tree
tree="${1-}"
Expand All @@ -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}"
Expand Down
Loading