diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2018-06-19 21:44:24 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2018-06-21 21:34:13 +0100 |
commit | 6bb014f251b0a3b5c6d0b3aa972c588d771d6867 (patch) | |
tree | f4a7aa54d3e07186bd2e69bff2688e6024461f9e /alot/__main__.py | |
parent | c30afc72150e30770da6fc1e5f6e68dce2b9a6bb (diff) |
lazy reading of config files in SettingsManager
This prevents SettingsManager from reading the config files right when
it is isntantiated and instead waits for the main module to call
`read_[notmuch]config` with the right path.
This should prevent problems with accidentally reading the default
config paths despite being told otherwise (via commandline options)
Diffstat (limited to 'alot/__main__.py')
-rw-r--r-- | alot/__main__.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/alot/__main__.py b/alot/__main__.py index b46985cb..1000f2c9 100644 --- a/alot/__main__.py +++ b/alot/__main__.py @@ -90,20 +90,17 @@ def main(): filemode='w', format=logformat) # locate alot config files + cpath = options.config if options.config is None: xdg_dir = get_xdg_env('XDG_CONFIG_HOME', os.path.expanduser('~/.config')) alotconfig = os.path.join(xdg_dir, 'alot', 'config') if os.path.exists(alotconfig): - settings.alot_rc_path = alotconfig - else: - settings.alot_rc_path = options.config - - settings.notmuch_rc_path = options.notmuch_config + cpath = alotconfig try: - settings.read_config() - settings.read_notmuch_config() + settings.read_config(cpath) + settings.read_notmuch_config(options.notmuch_config) except (ConfigError, OSError, IOError) as e: print('Error when parsing a config file. ' 'See log for potential details.') |