]> arthur.barton.de Git - ax-zsh.git/commitdiff
Simplify error checking on cache file creation
authorAlexander Barton <alex@barton.de>
Tue, 1 Feb 2022 20:17:03 +0000 (21:17 +0100)
committerAlexander Barton <alex@barton.de>
Tue, 1 Feb 2022 20:17:03 +0000 (21:17 +0100)
Just try to write to the cache file without testing first. And the
"cache_file" variable can never be empty, see code above!

ax.zsh

diff --git a/ax.zsh b/ax.zsh
index 8a433492fb49b836540d1f39ff4ccfa9dd3a0a18..3d693da9725fbf4cde83fec09e555017d69a6c6f 100644 (file)
--- a/ax.zsh
+++ b/ax.zsh
@@ -61,12 +61,10 @@ function axzsh_handle_stage {
                )
 
                # Create new cache file:
-               if [[ -n "$cache_file" && -w "$new_cache_file" ]]; then
-                       [[ -n "$AXZSH_DEBUG" ]] \
-                               && echo "   (Writing new cache file to \"$new_cache_file\" ...)"
-                       if ! printf "# %s\n\n" "$(LC_ALL=C date)" >"$new_cache_file"; then
-                               unset new_cache_file
-                       fi
+               [[ -n "$AXZSH_DEBUG" ]] \
+                       && echo "   (Writing new cache file to \"$new_cache_file\" ...)"
+               if ! printf "# %s\n\n" "$(LC_ALL=C date)" >"$new_cache_file"; then
+                       unset new_cache_file
                fi
 
                # Read in all the plugins for the current "type":