From adbaddfaf4ec3c1c6f3d149d595d15704a1a4ea6 Mon Sep 17 00:00:00 2001 From: Frederick Akalin Date: Tue, 27 Mar 2018 23:35:41 -0700 Subject: [PATCH] Fix reading of /etc/paths on OS X (and /etc/paths.d/*) Do so by emulating the behavior of /usr/libexec/path_helper for login shells, matching the behavior in /etc/profile. Also add a path_helper command to reproduce the behavior of /usr/libexec/path_helper for fish. This also handles setting MANPATH if necessary. Fixes issue #4336 --- share/config.fish | 91 +++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 54 deletions(-) diff --git a/share/config.fish b/share/config.fish index dddecae2a..c9a999fdf 100644 --- a/share/config.fish +++ b/share/config.fish @@ -126,59 +126,7 @@ if test -d /usr/xpg4/bin end end -# OS X-ism: Load the path files out of /etc/paths and /etc/paths.d/* -set -g __fish_tmp_path $PATH -function __fish_load_path_helper_paths - # We want to rearrange the path to reflect this order. Delete that path component if it exists and then prepend it. - # Since we are prepending but want to preserve the order of the input file, we reverse the array, append, and then reverse it again - set __fish_tmp_path $__fish_tmp_path[-1..1] - while read -l new_path_comp - if test -d $new_path_comp - set -l where (contains -i -- $new_path_comp $__fish_tmp_path) - and set -e __fish_tmp_path[$where] - set __fish_tmp_path $new_path_comp $__fish_tmp_path - end - end - set __fish_tmp_path $__fish_tmp_path[-1..1] -end -test -r /etc/paths -and __fish_load_path_helper_paths