mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-09-22 16:24:51 +00:00
[New] add support for $XDG_CONFIG_HOME
This commit is contained in:

committed by
Jordan Harband

parent
f218a85454
commit
8542df4ac5
@@ -16,9 +16,10 @@ install_dir=$(nvm_install_dir)
|
||||
[ "_$install_dir" = "_$NVM_DIR" ] || die "nvm_install_dir should use \$NVM_DIR if it exists. Current output: $install_dir"
|
||||
|
||||
unset NVM_DIR
|
||||
|
||||
# NVM_DIR is not set
|
||||
install_dir=$(nvm_install_dir)
|
||||
[ "_$install_dir" = "_$HOME/.nvm" ] || die "nvm_install_dir should default to \$HOME/.nvm. Current output: $install_dir"
|
||||
fallback_dir=""
|
||||
[ ! -z "$XDG_CONFIG_HOME" ] && fallback_dir="$XDG_CONFIG_HOME/nvm" || fallback_dir="$HOME/.nvm"
|
||||
[ "_$install_dir" = "_$fallback_dir" ] || die "nvm_install_dir should default to \$XDG_CONFIG_DIR/.nvm. Current output: $install_dir"
|
||||
|
||||
cleanup
|
||||
|
Reference in New Issue
Block a user