Keep the order for $PATH and $MANPATH when reading /etc/paths (#5767)

* Keep the order for $PATH and $MANPATH when reading /etc/paths

Fixes #5456.
This commit is contained in:
Fabian Homborg 2019-03-30 19:25:09 +01:00 committed by GitHub
parent 0aa0dceeb3
commit 7aaa3b8553
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,7 +173,9 @@ if status --is-login
# executable for fish; see # executable for fish; see
# https://opensource.apple.com/source/shell_cmds/shell_cmds-203/path_helper/path_helper.c.auto.html . # https://opensource.apple.com/source/shell_cmds/shell_cmds-203/path_helper/path_helper.c.auto.html .
function __fish_macos_set_env -d "set an environment variable like path_helper does (macOS only)" function __fish_macos_set_env -d "set an environment variable like path_helper does (macOS only)"
set -l result # The first argument is the variable name, the others are the files.
# Keep the components already there so we don't change the order
set -l result $$argv[1]
for path_file in $argv[2] $argv[3]/* for path_file in $argv[2] $argv[3]/*
if [ -f $path_file ] if [ -f $path_file ]
@ -185,12 +187,6 @@ if status --is-login
end end
end end
for entry in $$argv[1]
if not contains -- $entry $result
set result $result $entry
end
end
set -xg $argv[1] $result set -xg $argv[1] $result
end end