[Fix] Remove $NVM_DIR trailing slash automatically, fix #1708

This commit is contained in:
Peter Dave Hello
2018-04-12 14:14:58 +08:00
committed by Jordan Harband
parent 42f11acce1
commit 685312d600
2 changed files with 23 additions and 0 deletions

5
nvm.sh
View File

@@ -257,6 +257,11 @@ if [ -z "${NVM_DIR-}" ]; then
# shellcheck disable=SC1001
NVM_DIR="$(nvm_cd ${NVM_CD_FLAGS} "$(dirname "${NVM_SCRIPT_SOURCE:-$0}")" > /dev/null && \pwd)"
export NVM_DIR
else
while echo "${NVM_DIR}" | nvm_grep -q "/$"; do
export NVM_DIR="${NVM_DIR%/}"
done
nvm_err "Warning: \$NVM_DIR should not have trailing slash"
fi
unset NVM_SCRIPT_SOURCE 2> /dev/null