mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:17:12 +08:00
Fix xdg mimetype completion
This hung when no file existed, and failed to properly find the directories if they didn't end in a "/". Fixes #6525 [good for 3.1.0]
This commit is contained in:
parent
e398f66772
commit
d61c188c3c
|
@ -11,8 +11,8 @@ function __fish_print_xdg_applications_directories --description 'Print director
|
|||
|
||||
set data_dirs $data_home:$data_dirs
|
||||
|
||||
for path in (string split : $data_dirs)
|
||||
set path $path"applications"
|
||||
# We don't know if the dir ended in a "/" or not, but duplicate slashes are okay.
|
||||
for path in (string split : $data_dirs)/applications
|
||||
if test -d $path
|
||||
echo $path
|
||||
end
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
function __fish_print_xdg_mimetypes --description 'Print XDG mime types'
|
||||
cat (__fish_print_xdg_applications_directories)/mimeinfo.cache 2>/dev/null | string match -v '[MIME Cache]' | string replace = \t
|
||||
set -l files (__fish_print_xdg_applications_directories)/mimeinfo.cache
|
||||
# If we have no file, don't run `cat` without arguments!
|
||||
set -q files[1] || return 1
|
||||
cat $files 2>/dev/null | string match -v '[MIME Cache]' | string replace = \t
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user