Commit bd8c427d authored by Ian Beckwith's avatar Ian Beckwith

Implemented XDG basedir spec for local config

(http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html)
Local config is searched for in:
  * $SURFRAW_conf if defined
  * $XDG_CONFIG_HOME/surfraw/conf
  * $HOME/.config/surfraw/conf
  * $HOME/.surfraw.conf (for backwards compatibility)
Removed definition of SURFRAW_conf from global config
parent 3e4591d8
......@@ -50,13 +50,35 @@ load_global_conf () {
. "$conf"
}
w3_config () {
prefix=@prefix@
def SURFRAW_conf $HOME/.surfraw.conf
find_config_file () {
base="$1"
if test -n "$XDG_CONFIG_HOME" && test -r "$XDG_CONFIG_HOME/surfraw/$base"; then
echo "$XDG_CONFIG_HOME/surfraw/$base"
elif test -n "$HOME" && test -r "$HOME/.config/surfraw/$base"; then
echo "$HOME/.config/surfraw/$base"
elif test -r "$HOME/.surfraw.$base"; then
echo "$HOME/.surfraw.$base"
fi
}
load_local_conf () {
local conf
conf=""
if test -n "$SURFRAW_conf" && test -r "$SURFRAW_conf"; then
conf="$SURFRAW_conf"
else
conf="$(find_config_file conf)"
fi
if test -n "$conf"; then
. $conf
fi
}
w3_config () {
load_global_conf
w3_config_hook
test -r "$SURFRAW_conf" && . "$SURFRAW_conf"
load_local_conf
}
warn () {
......
......@@ -26,9 +26,6 @@
# autoconf guessed prefix
prefix=@prefix@
# secondary configuation file
def SURFRAW_conf $HOME/.surfraw.conf
# graphical browser? defaults to yes for meatminds. text browser users can
# work it out how to change it.
defyn SURFRAW_graphical yes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment