mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00: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
2 changed files with 6 additions and 3 deletions
|
@ -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 a new issue