Skip to content
Browse files

Use XDG Base Directory instead of a .directory

Host files are read from $XDG_CONFIG_HOME/resty. Cookies and host file
are stored in $XDG_DATA_HOME/resty/c and $XDG_DATA_HOME/resty/host,
respectively.  One less .directory in $HOME.
  • Loading branch information...
1 parent d9f001e commit 39ac1c97826f712b3b272547f7bf8d03934158d6 @namelessjon namelessjon committed Jul 13, 2011
Showing with 6 additions and 4 deletions.
  1. +6 −4 resty
View
10 resty
@@ -14,13 +14,15 @@ export _resty_path=""
export _resty_nohistory=""
function resty() {
- local confdir host cookies method h2t editor domain _path opt dat res ret out err verbose raw i j d tmpf args2 wantdata vimedit quote query maybe_query
+ local confdir datadir host cookies method h2t editor domain _path opt dat res ret out err verbose raw i j d tmpf args2 wantdata vimedit quote query maybe_query
local -a curlopt
local -a curlopt2
- confdir="${HOME}/.resty"
- host="${confdir}/host"
- cookies="$confdir/c"
+ confdir="${XDG_CONFIG_HOME}/resty"
+ mkdir -p "$confdir"
+ datadir="${XDG_DATA_HOME}/resty"
+ host="$datadir/host"
+ cookies="$datadir/c"
method="$1"; [[ $# > 0 ]] && shift
h2t=$((exec 2>&-; (which lynx >/dev/null && echo lynx -stdin -dump) \
|| which html2text || which cat) |tail -n 1)

0 comments on commit 39ac1c9

Please sign in to comment.
Something went wrong with that request. Please try again.