mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
e1ee193822
Don't fork/exec an external process, especially one performing IO, if we don't have to. This, in turn, speeds up __fish_source_cached_completions which is rather slow under WSL (and slower than it needs to be on other platforms).
13 lines
620 B
Fish
13 lines
620 B
Fish
function __fish_make_cache_dir --description "Create and return XDG_CACHE_HOME"
|
|
set -l xdg_cache_home $XDG_CACHE_HOME
|
|
if test -z "$xdg_cache_home"; or string match -qv '/*' -- $xdg_cache_home; or set -q xdg_cache_home[2]
|
|
set xdg_cache_home $HOME/.cache
|
|
end
|
|
|
|
# If we get an argument, we try to create that as a subdirectory.
|
|
# So if you call `__fish_make_cache_dir completions`,
|
|
# this creates e.g. ~/.cache/fish/completions
|
|
if not path is -d $xdg_cache_home/fish/"$argv[1]"
|
|
mkdir -m 700 -p $xdg_cache_home/fish/"$argv[1]"
|
|
end; and echo $xdg_cache_home/fish/"$argv[1]"
|
|
end
|