From c1064550872bfc16afe02ec6edeb73ff3847a3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C5=8Dshin?= Date: Thu, 30 May 2024 11:58:37 -0700 Subject: [PATCH] [Fix] `install.sh`: install looks for .zshenv A zsh user may have set `ZDOTDIR` to something other than `$HOME`, in which case the profile and rc files will not be located under `$HOME`. But unless the system `zshenv` has done something unusual, it is usually a safe bet that there will be a `$HOME/.zshenv` that, if nothing else, will be setting up `ZDOTDIR`. --- install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 40c1cdf6ab..6aaf7aa2f8 100755 --- a/install.sh +++ b/install.sh @@ -40,7 +40,7 @@ nvm_profile_is_bash_or_zsh() { local TEST_PROFILE TEST_PROFILE="${1-}" case "${TEST_PROFILE-}" in - *"/.bashrc" | *"/.bash_profile" | *"/.zshrc" | *"/.zprofile") + *"/.bashrc" | *"/.bash_profile" | *"/.zshenv" | *"/.zshrc" | *"/.zprofile") return ;; *) @@ -300,11 +300,13 @@ nvm_detect_profile() { DETECTED_PROFILE="$HOME/.zshrc" elif [ -f "$HOME/.zprofile" ]; then DETECTED_PROFILE="$HOME/.zprofile" + elif [ -f "$HOME/.zshenv" ]; then + DETECTED_PROFILE="$HOME/.zshenv" fi fi if [ -z "$DETECTED_PROFILE" ]; then - for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zprofile" ".zshrc" + for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zprofile" ".zshrc" ".zshenv" do if DETECTED_PROFILE="$(nvm_try_profile "${HOME}/${EACH_PROFILE}")"; then break