diff --git a/bin/mw b/bin/mw index c0c6f7a..57fd7b5 100755 --- a/bin/mw +++ b/bin/mw @@ -20,7 +20,7 @@ mbsyncrc="${MBSYNCRC_HOME:-$HOME/.mbsyncrc}" mwconfig="$muttshare/mutt-wizard.muttrc" cachedir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard" muttrc="$muttdir/muttrc" -msmtprc="${XDG_CACHE_HOME:-$HOME/.config}/msmtp/config" +msmtprc="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" ssltype="IMAPS" # This is later changed to `None` later in the script if using Protonmail alias mbsync='mbsync -c "$mbsyncrc"' @@ -193,7 +193,7 @@ EOF echo "$maxmes" | grep "[1-9]" >/dev/null || maxmes="0" getpass getprofiles - mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "$HOME/.config/msmtp" + mkdir -p "$muttdir" "$accdir" "$cachedir/$title/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" getaccounts for x in $(seq 1 9); do echo "$accounts" | grep "$x" >/dev/null 2>&1 || { export idnum="$x"; break ;}; done [ ! -f "$msmtprc" ] && echo "$msmtp_header" > "$msmtprc" @@ -203,6 +203,7 @@ EOF protonmail.ch|protonmail.com|pm.me) protonfinger || return 1 ;; esac echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc" + mkdir -p "${mbsyncrc%/*}" echo "$mbsync_profile" >> "$mbsyncrc" notmuchauto [ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created." @@ -289,7 +290,7 @@ asktype() { while : ; do esac; done ;} purge() { confirm "delete all account data" || exit - rm -rf "$mbsyncrc" "$accdir" "$HOME/.config/msmtp" "$cachedir" + rm -rf "$mbsyncrc" "$accdir" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$cachedir" echo "All configs and account settings have been purged." sed -ibu "/\# mw-autogenerated/d" "$muttrc" ; rm -f "$muttrc"bu }