diff options
Diffstat (limited to 'alot/__main__.py')
-rw-r--r-- | alot/__main__.py | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/alot/__main__.py b/alot/__main__.py index de46a727..c7114c8c 100644 --- a/alot/__main__.py +++ b/alot/__main__.py @@ -78,17 +78,14 @@ def main(): filemode='w', format=logformat) # locate alot config files - configfiles = [ - os.path.join(os.environ.get('XDG_CONFIG_HOME', - os.path.expanduser('~/.config')), - 'alot', 'config'), - ] - if options.config: - expanded_path = os.path.expanduser(options.config) - if not os.path.exists(expanded_path): - msg = 'Config file "%s" does not exist. Goodbye for now.' - sys.exit(msg % expanded_path) - configfiles.insert(0, expanded_path) + if options.config is None: + alotconfig = os.path.join( + os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config')), + 'alot', 'config') + if not os.path.exists(alotconfig): + alotconfig = None + else: + alotconfig = options.config # locate notmuch config notmuchpath = os.environ.get('NOTMUCH_CONFIG', '~/.notmuch-config') @@ -96,13 +93,6 @@ def main(): notmuchpath = options.notmuch_config notmuchconfig = os.path.expanduser(notmuchpath) - alotconfig = None - # read the first alot config file we find - for configfilename in configfiles: - if os.path.exists(configfilename): - alotconfig = configfilename - break # use only the first - try: settings.read_config(alotconfig) settings.read_notmuch_config(notmuchconfig) |