mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Tweak config.fish to only modify PATH once, for performance
This commit is contained in:
parent
818533f9f0
commit
cd276030c1
1 changed files with 10 additions and 4 deletions
|
@ -71,14 +71,20 @@ switch $USER
|
||||||
set path_list $path_list /sbin /usr/sbin /usr/local/sbin
|
set path_list $path_list /sbin /usr/sbin /usr/local/sbin
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# It's desirable to only modify PATH once, because fish will check it for validity,
|
||||||
|
# which performs disk I/O. Construct the new PATH locally.
|
||||||
|
#
|
||||||
|
|
||||||
|
set -l path_under_construction $PATH
|
||||||
for i in $path_list
|
for i in $path_list
|
||||||
if not contains $i $PATH
|
if begin ; not contains $i $path_under_construction ; and test -d $i ; end
|
||||||
if test -d $i
|
set path_under_construction $path_under_construction $i
|
||||||
set PATH $PATH $i
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
set PATH $path_under_construction
|
||||||
|
|
||||||
#
|
#
|
||||||
# Launch debugger on SIGTRAP
|
# Launch debugger on SIGTRAP
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue