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/settings | |
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/settings')
-rw-r--r-- | alot/settings/manager.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/alot/settings/manager.py b/alot/settings/manager.py index 296ef22b..99954639 100644 --- a/alot/settings/manager.py +++ b/alot/settings/manager.py @@ -15,7 +15,7 @@ from configobj import ConfigObj, Section from ..account import SendmailAccount from ..addressbook.abook import AbookAddressBook from ..addressbook.external import ExternalAddressbook -from ..helper import pretty_datetime, string_decode +from ..helper import pretty_datetime, string_decode, get_env from ..utils import configobj as checks from .errors import ConfigError, NoMatchingAccount @@ -25,8 +25,8 @@ from .theme import Theme DEFAULTSPATH = os.path.join(os.path.dirname(__file__), '..', 'defaults') -DATA_DIRS = os.environ.get('XDG_DATA_DIRS', - '/usr/local/share:/usr/share').split(':') +DATA_DIRS = get_env('XDG_DATA_DIRS', + '/usr/local/share:/usr/share').split(':') class SettingsManager(object): @@ -157,8 +157,8 @@ class SettingsManager(object): if path: path = os.path.expanduser(path) else: - xdgdir = os.environ.get('XDG_CONFIG_HOME', - os.path.expanduser('~/.config')) + xdgdir = get_env('XDG_CONFIG_HOME', + os.path.expanduser('~/.config')) path = os.path.join(xdgdir, fallback) self._config[setting_name] = path |