add xdg env check
This commit is contained in:
parent
ac5ce1fbe6
commit
6a15c81069
|
@ -23,26 +23,28 @@ if [[ -d "$HOME/.local/bin" ]] ; then
|
|||
fi
|
||||
|
||||
# Check if XDG environment variables are set or set them to default
|
||||
if [[ -z "$XDG_DATA_HOME" ]]; then
|
||||
export XDG_DATA_HOME=$HOME/.local/share
|
||||
fi
|
||||
if [[ -z "$XDG_CONFIG_HOME" ]]; then
|
||||
export XDG_CONFIG_HOME=$HOME/.config
|
||||
fi
|
||||
if [[ -z "$XDG_STATE_HOME" ]]; then
|
||||
export XDG_STATE_HOME=$HOME/.local/state
|
||||
fi
|
||||
if [[ -z "$XDG_CACHE_HOME" ]]; then
|
||||
export XDG_CACHE_HOME=$HOME/.cache
|
||||
fi
|
||||
|
||||
# Check presence of locale Download folder or create a default one
|
||||
if [[ "$(xdg-user-dir DOWNLOAD)" == "$(xdg-user-dir)" ]]; then
|
||||
mkdir -p "$HOME/Downloads"
|
||||
export XDG_DOWNLOAD_DIR="$HOME/Downloads"
|
||||
else
|
||||
XDG_DOWNLOAD_DIR="$(xdg-user-dir DOWNLOAD)"
|
||||
export XDG_DOWNLOAD_DIR
|
||||
if command -v xdg-user-dir 1> /dev/null; then
|
||||
if [[ -z "$XDG_DATA_HOME" ]]; then
|
||||
export XDG_DATA_HOME=$HOME/.local/share
|
||||
fi
|
||||
if [[ -z "$XDG_CONFIG_HOME" ]]; then
|
||||
export XDG_CONFIG_HOME=$HOME/.config
|
||||
fi
|
||||
if [[ -z "$XDG_STATE_HOME" ]]; then
|
||||
export XDG_STATE_HOME=$HOME/.local/state
|
||||
fi
|
||||
if [[ -z "$XDG_CACHE_HOME" ]]; then
|
||||
export XDG_CACHE_HOME=$HOME/.cache
|
||||
fi
|
||||
|
||||
# Check presence of locale Download folder or create a default one
|
||||
if [[ "$(xdg-user-dir DOWNLOAD)" == "$(xdg-user-dir)" ]]; then
|
||||
mkdir -p "$HOME/Downloads"
|
||||
export XDG_DOWNLOAD_DIR="$HOME/Downloads"
|
||||
else
|
||||
XDG_DOWNLOAD_DIR="$(xdg-user-dir DOWNLOAD)"
|
||||
export XDG_DOWNLOAD_DIR
|
||||
fi
|
||||
fi
|
||||
|
||||
# ==============================
|
||||
|
|
Loading…
Reference in a new issue