Update xdg-desktop-search

This commit is contained in:
Tilman Kranz 2024-11-14 04:57:31 +01:00
parent 25e7e3f454
commit f7f760cba9

View File

@ -167,6 +167,20 @@ parse_options() {
[[ "${#search[@]}" -gt 0 ]] && search_regex="^$search_directives_regex=.*($(join "|" ${search[@]}))" [[ "${#search[@]}" -gt 0 ]] && search_regex="^$search_directives_regex=.*($(join "|" ${search[@]}))"
} }
valid_data_dirs() {
local dirs=$1
local IFS=:
local result=()
for dir in $dirs ; do
if [[ -d $dir ]] && [[ -r $dir ]] ; then
result+=( "$dir" )
fi
done
echo "${result[*]}"
}
## ##
# Main Program # Main Program
@ -176,7 +190,7 @@ parse_options $@
found=0 found=0
for _data_dir in $xdg_data_dirs ; do for _data_dir in valid_data_dirs "$xdg_data_dirs" ; do
data_dir=$(realpath --canonicalize-missing --no-symlinks "$_data_dir") data_dir=$(realpath --canonicalize-missing --no-symlinks "$_data_dir")
applications="$data_dir/applications" applications="$data_dir/applications"