Abort if VDIRSYNCER_CONFIG is invalid

Fix #193
This commit is contained in:
Markus Unterwaditzer 2015-04-12 14:48:29 +02:00
parent 90d283b3b8
commit 172a2b9b98

View file

@ -292,12 +292,14 @@ def _validate_pair_section(pair_config):
def load_config():
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')
fname = os.environ.get('VDIRSYNCER_CONFIG', None)
if not fname:
fname = expand_path('~/.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:
with open(fname) as f:
general, pairs, storages = read_config(f)