- if [[ -v XDG_DATA_HOME ]] {
- export XDG_DATA_HOME
- } elif [[ ! -e ~/.local/share ]] {
- mkdir -m760 ~/.local/share
- }
- xdg_data_dirs=($XDG_DATA_HOME /{opt,usr/local,usr/pkg,usr}/share
- ${XDG_DATA_DIRS:+${xdg_data_dirs%%/}})
+ [[ -v XDG_DATA_HOME ]] && export XDG_DATA_HOME
+ [[ -e ${XDG_DATA_HOME:-~/.local/share} ]] ||
+ mkdir -m760 ${XDG_DATA_HOME:-~/.local/share}
+ xdg_data_dirs=($XDG_DATA_HOME ${XDG_DATA_DIRS:+${xdg_data_dirs%%/}}
+ /{usr{,/local,/pkg},opt{,/*{/*,}}}/share(N))
+ xdg_data_dirs=($xdg_data_dirs(/N))