Use XDG-Basedir as a fallback for configuration file location.

This commit is contained in:
Hugo Osvaldo Barrera 2014-12-14 17:45:48 -03:00
parent e40ba55bd3
commit 4c7042da56

View file

@ -273,6 +273,10 @@ def _create_app():
if 'config' not in ctx.obj:
fname = expand_path(os.environ.get('VDIRSYNCER_CONFIG',
'~/.vdirsyncer/config'))
if not os.path.exists(fname):
xdg_config_dir = os.environ.get('XDG_CONFIG_HOME',
expand_path('~/.config/'))
fname = os.path.join(xdg_config_dir, 'vdirsyncer/config')
try:
ctx.obj['config'] = load_config(fname)
except Exception as e: