From e1ee193822007a64dac1edd82c77eda8ff36eb13 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 30 May 2024 17:03:03 -0500 Subject: [PATCH] Speed up __fish_make_cache_dir 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). --- share/functions/__fish_make_cache_dir.fish | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/functions/__fish_make_cache_dir.fish b/share/functions/__fish_make_cache_dir.fish index e068027ba..1d6714a7b 100644 --- a/share/functions/__fish_make_cache_dir.fish +++ b/share/functions/__fish_make_cache_dir.fish @@ -7,6 +7,7 @@ function __fish_make_cache_dir --description "Create and return XDG_CACHE_HOME" # 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 - mkdir -m 700 -p $xdg_cache_home/fish/"$argv[1]" - and echo $xdg_cache_home/fish/"$argv[1]" + 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