diff --git a/1pass b/1pass index 3d747b6..c174ff8 100755 --- a/1pass +++ b/1pass @@ -23,16 +23,20 @@ set -o pipefail VERSION="1.6.1" -if [ "$XDG_CONFIG_HOME" != "" ] && [ ! -d "${HOME}/.1pass" ]; then - op_dir="${XDG_CONFIG_HOME}/1pass" +if [ -d "${HOME}/.1pass" ]; then + op_dir="${HOME}/.1pass" +elif [ "$XDG_CONFIG_HOME" != "" ]; then + op_dir="${XDG_CONFIG_HOME}/1pass" else - op_dir=${HOME}/.1pass + op_dir="${HOME}/.config/1pass" fi -if [ "$XDG_CACHE_HOME" != "" ] && [ ! -d "${op_dir}/cache" ]; then - cache_dir="${XDG_CACHE_HOME}/1pass" +if [ -d "${op_dir}/cache" ]; then + cache_dir="${op_dir}/cache" +elif [ "$XDG_CACHE_HOME" != "" ]; then + cache_dir="${XDG_CACHE_HOME}/1pass" else - cache_dir=${op_dir}/cache + cache_dir="${HOME}/.cache/1pass" fi os=$(uname) @@ -54,7 +58,7 @@ fi # test setup: if [ ! -d "$op_dir" ] || [ ! -r "${op_dir}/config" ]; then - mkdir -p "$cache_dir" + mkdir -p "$op_dir" cat > "${op_dir}/config" <