Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully respect xdg base dir spec #47

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions 1pass
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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" <<CONFIG
# configuration file for 1pass

Expand Down