diff --git a/share/fish.in b/share/fish.in index 1e33f1f5c..9418cbcf8 100644 --- a/share/fish.in +++ b/share/fish.in @@ -4,6 +4,29 @@ # completions are located in the completions subdirectory. # +# +# Assign a temporary value here for performance reasons. The real value should be set in /etc/fish. +# + +set -g fish_function_path $PWD/functions/ + +# +# Make sure there are no invalid entries in the PATH +# + +set -l erase_idx +for idx in (seq (count $PATH)) + set i $PATH[$idx] + if not test -d $i + set erase_idx $erase_idx $idx + printf (_ '%s: Warning: The directory %s has been removed from your PATH, because it does not exist\n') fish $i + end +end + +if count $erase_idx >/dev/null + set -e PATH[(echo $erase_idx)] +end + # # Add a few common directories to path, if they exists. Note that pure # console programs like makedep sometimes live in /usr/X11R6/bin, so we @@ -26,12 +49,6 @@ for i in $path_list end end -# -# Assign a temporary value here for performance reasons. The real value should be set in /etc/fish. -# - -set -g fish_function_path $PWD/functions/ - # # Don't need completions in non-interactive mode #