mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-12 09:41:47 +02:00
install.sh: Honor XDG_DATA_HOME
[why] When a user sets the XDG_DATA_HOME environment variable the default of $HOME/.local/share should not be used. https://wiki.archlinux.org/title/XDG_Base_Directory [how] Enable XDG_DATA_HOME to override the default user data directory on Unix and MacOS platforms. There is some controversy if XDG_DATA_HOME should be honored on MacOS, see for example platformdirs (link below). But me also working on Linux and MacOS (and Windows) in parallel, I can not quite follow the downsides and believe we should allow XDG_DATA_HOME also for MacOS. Related: https://github.com/platformdirs/platformdirs/issues/4 Fixes: #1324 Suggested-by: Anthony Foglia <@afoglia> Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
4b11f751a1
commit
e398a3847c
1 changed files with 12 additions and 7 deletions
19
install.sh
19
install.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Install Nerd Fonts
|
# Install Nerd Fonts
|
||||||
__ScriptVersion="0.6"
|
__ScriptVersion="0.7"
|
||||||
|
|
||||||
# Default values for option variables:
|
# Default values for option variables:
|
||||||
quiet=false
|
quiet=false
|
||||||
|
@ -197,15 +197,20 @@ done
|
||||||
# Get target root directory
|
# Get target root directory
|
||||||
if [[ $(uname) == 'Darwin' ]]; then
|
if [[ $(uname) == 'Darwin' ]]; then
|
||||||
# MacOS
|
# MacOS
|
||||||
sys_font_dir="/Library/Fonts"
|
sys_share_dir="/Library"
|
||||||
usr_font_dir="$HOME/Library/Fonts"
|
usr_share_dir="$HOME/Library"
|
||||||
|
font_subdir="Fonts"
|
||||||
else
|
else
|
||||||
# Linux
|
# Linux
|
||||||
sys_font_dir="/usr/local/share/fonts"
|
sys_share_dir="/usr/local/share"
|
||||||
usr_font_dir="$HOME/.local/share/fonts"
|
usr_share_dir="$HOME/.local/share"
|
||||||
|
font_subdir="fonts"
|
||||||
fi
|
fi
|
||||||
sys_font_dir="${sys_font_dir}/NerdFonts"
|
if [ -n "${XDG_DATA_HOME}" ]; then
|
||||||
usr_font_dir="${usr_font_dir}/NerdFonts"
|
usr_share_dir="${XDG_DATA_HOME}"
|
||||||
|
fi
|
||||||
|
sys_font_dir="${sys_share_dir}/${font_subdir}/NerdFonts"
|
||||||
|
usr_font_dir="${usr_share_dir}/${font_subdir}/NerdFonts"
|
||||||
|
|
||||||
if [[ "system" == "$installpath" ]]; then
|
if [[ "system" == "$installpath" ]]; then
|
||||||
font_dir="${sys_font_dir}"
|
font_dir="${sys_font_dir}"
|
||||||
|
|
Loading…
Reference in a new issue