Respect $TMPDIR if it exists

This commit is contained in:
Kid 2021-08-29 11:46:33 +08:00 committed by Kid
parent aa026545b9
commit 765b03643d

View file

@ -4807,10 +4807,11 @@ cache() {
} }
get_cache_dir() { get_cache_dir() {
case $os in if [[ "$TMPDIR" ]]; then
"Mac OS X"|"macOS") cache_dir="/Library/Caches" ;; cache_dir="$TMPDIR"
*) cache_dir="/tmp" ;; else
esac cache_dir="/tmp"
fi
} }
kde_config_dir() { kde_config_dir() {
@ -5363,8 +5364,7 @@ get_args() {
"--gap") gap="$2" ;; "--gap") gap="$2" ;;
"--clean") "--clean")
[[ -d "$thumbnail_dir" ]] && rm -rf "$thumbnail_dir" [[ -d "$thumbnail_dir" ]] && rm -rf "$thumbnail_dir"
rm -rf "/Library/Caches/neofetch/" rm -rf "$cache_dir/neofetch/"
rm -rf "/tmp/neofetch/"
exit exit
;; ;;
@ -11477,6 +11477,7 @@ EOF
main() { main() {
cache_uname cache_uname
get_os get_os
get_cache_dir
# Load default config. # Load default config.
eval "$config" eval "$config"
@ -11499,7 +11500,6 @@ main() {
} }
image_backend image_backend
get_cache_dir
old_functions old_functions
print_info print_info
dynamic_prompt dynamic_prompt