diff options
author | Julian Mehne <julian.mehne@posteo.de> | 2018-01-21 19:08:19 +0100 |
---|---|---|
committer | Julian Mehne <julian.mehne@posteo.de> | 2018-01-21 20:10:09 +0100 |
commit | 0935ccfd5c8cd00dd7b55a06133c6b5cf6368668 (patch) | |
tree | f6278deddadc2813a226f818eeb3c61f154a0daf /alot/__main__.py | |
parent | 6f1a8b687dde23458b141c36f3044cf10fa008af (diff) |
Fix empty XDG_* environment variables.
Use fallback, if an enviroment variable is unset *or* empty.
Bug:
- XDG_CONFIG_HOME='' alot
Problem:
Does not find the configuration file (among others), because
os.environ.get('XDG_CONFIG_HOME', '~/.config') returns '', instead of
'~/.config'.
Diffstat (limited to 'alot/__main__.py')
-rw-r--r-- | alot/__main__.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alot/__main__.py b/alot/__main__.py index ee5e442a..207c8b92 100644 --- a/alot/__main__.py +++ b/alot/__main__.py @@ -11,6 +11,7 @@ import sys import alot from alot.settings.const import settings from alot.settings.errors import ConfigError +from alot.helper import get_env from alot.db.manager import DBManager from alot.ui import UI from alot.commands import * @@ -92,9 +93,8 @@ def main(): # locate alot config files if options.config is None: - alotconfig = os.path.join( - os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config')), - 'alot', 'config') + xdg_dir = get_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: |