diff --git a/share/functions/__fish_print_xdg_applications_directories.fish b/share/functions/__fish_print_xdg_applications_directories.fish index c4a102aca..d7a71532c 100644 --- a/share/functions/__fish_print_xdg_applications_directories.fish +++ b/share/functions/__fish_print_xdg_applications_directories.fish @@ -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 diff --git a/share/functions/__fish_print_xdg_mimetypes.fish b/share/functions/__fish_print_xdg_mimetypes.fish index 97070e042..047f2cea4 100644 --- a/share/functions/__fish_print_xdg_mimetypes.fish +++ b/share/functions/__fish_print_xdg_mimetypes.fish @@ -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