From eea75569585befe2fe58a0dbe5bfcbd7e04f223d Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sat, 2 Nov 2019 21:42:15 +0100 Subject: [PATCH] 30_env: Test for and create missing directories Not only test if the variables are set, but create the directories when missing, too! --- core/30_env/30_env.zprofile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/30_env/30_env.zprofile b/core/30_env/30_env.zprofile index 653d82e..781a9ec 100644 --- a/core/30_env/30_env.zprofile +++ b/core/30_env/30_env.zprofile @@ -9,6 +9,8 @@ fi # Setup XDG cache directory if [[ -z "$XDG_CACHE_HOME" ]]; then XDG_CACHE_HOME="$LOCAL_HOME/.cache" +fi +if [[ ! -d "$XDG_CACHE_HOME" ]]; then mkdir -p "$XDG_CACHE_HOME" chmod 0700 "$XDG_CACHE_HOME" fi @@ -17,6 +19,8 @@ export XDG_CACHE_HOME # Setup XDG runtime directory if [[ -z "$XDG_RUNTIME_DIR" ]]; then XDG_RUNTIME_DIR="${TMPDIR:-/tmp/${UID}-runtime-dir}" +fi +if [[ ! -d "$XDG_RUNTIME_DIR" ]]; then mkdir -p "$XDG_RUNTIME_DIR" chmod 0700 "$XDG_RUNTIME_DIR" fi @@ -25,6 +29,8 @@ export XDG_RUNTIME_DIR # Setup ZSH cache directory if [[ -z "$ZSH_CACHE_DIR" ]]; then ZSH_CACHE_DIR="$XDG_CACHE_HOME/zsh" +fi +if [[ ! -d "$ZSH_CACHE_DIR" ]]; then mkdir -p "$ZSH_CACHE_DIR" chmod 0700 "$ZSH_CACHE_DIR" fi -- 2.39.2