Skip to content

Commit

Permalink
🐛 Fix a duplicate path addition
Browse files Browse the repository at this point in the history
The previous path addition doesn't have a guard statement. It probably
spawns value duplicated $PATH such as
'PATH=/a/path:~/.exa/bin:~/.exa/bin:~/.exa/bin' when runs nested zsh. So
adds a guard statement to check whether or not the exa bin directory
path exists in $PATH.

$PATH is exported by default, so no need to re-export explicitly. And
$path is a tied variable to $PATH, so we can think as it is exported
too.
  • Loading branch information
a5ob7r committed Apr 10, 2022
1 parent 896860c commit 46ddca3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zsh-exa.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ update_zsh_exa() {
}

_zsh_exa_load() {
# export PATH
export PATH=${PATH}:${EXA_HOME}/bin
local -r exadir=$EXA_HOME/bin

# Add the exa bin directory path if it doesn't exist in $PATH.
if [[ -z ${path[(r)$exadir]} ]]; then
path+=($exadir)
fi
}

# install exa if it isnt already installed
Expand Down

0 comments on commit 46ddca3

Please sign in to comment.