]> arthur.barton.de Git - ax-zsh.git/blobdiff - core/30_env/30_env.zshrc
30_env: Make sure the default environment is always set
[ax-zsh.git] / core / 30_env / 30_env.zshrc
index 4187712e17cae0ced9455627de536ee8d2ccdac6..cac098a194cde4d1b5be0b02946a574da780ada8 100644 (file)
@@ -1,17 +1,14 @@
 # AX-ZSH: Alex' Modular ZSH Configuration
 # 30_env.ax-io: Setup environment
 
-# Make sure TMPDIR ends in a slash (like on macOS by default): this makes its
-# usage a bit safer ...
-case "$TMPDIR" in
-       */) ;;
-       *)  TMPDIR="$TMPDIR/"
-esac
-export TMPDIR
-
-# TMPDIR is the only one required to be set, but make sure that TMP, TEMP
-# and TEMPDIR are set to the same sane path name when already present in the
-# environment:
-[[ -n "$TMP" ]] && TMP="$TMPDIR"
-[[ -n "$TEMP" ]] && TEMP="$TMPDIR"
-[[ -n "$TEMPDIR" ]] && TEMPDIR="$TMPDIR"
+if [[
+       "$TMPDIR" = '/' ||
+       -z "$TMPDIR" ||
+       -z "$XDG_CACHE_HOME" ||
+       -z "$XDG_RUNTIME_DIR" ||
+       -z "$ZSH_CACHE_DIR"
+]]; then
+       # Looks like the environment wasn't set up/exported properly!
+       [[ -n "$AXZSH_DEBUG" ]] && echo 'Note: Fixing up the environment!'
+       . "$AXZSH/core/30_env/30_env.ax-io"
+fi