[Fix] Make installation less restrictive when NVM_DIR is set

Ahmed El Sayegh 2019-01-21 02:15:02 +02:00 committed by Jordan Harband
parent 10f24d6d4b
commit 703babe60a
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
1 changed files with 11 additions and 2 deletions

View File

@ -304,9 +304,18 @@ nvm_check_global_modules() {
nvm_do_install() { nvm_do_install() {
if [ -n "${NVM_DIR-}" ] && ! [ -d "${NVM_DIR}" ]; then if [ -n "${NVM_DIR-}" ] && ! [ -d "${NVM_DIR}" ]; then
if [ "${NVM_DIR}" == "$HOME/.nvm" ]; then
if [ -e "${NVM_DIR}" ]; then
echo >&2 "File \"${NVM_DIR}\" has the same name as installation directory."
exit 1
else
mkdir "${NVM_DIR}"
fi
else
echo >&2 "You have \$NVM_DIR set to \"${NVM_DIR}\", but that directory does not exist. Check your profile files and environment." echo >&2 "You have \$NVM_DIR set to \"${NVM_DIR}\", but that directory does not exist. Check your profile files and environment."
exit 1 exit 1
fi fi
fi
if [ -z "${METHOD}" ]; then if [ -z "${METHOD}" ]; then
# Autodetect install method # Autodetect install method
if nvm_has git; then if nvm_has git; then