diff --git a/khal/settings/settings.py b/khal/settings/settings.py index f67ef2776..3712c3bef 100644 --- a/khal/settings/settings.py +++ b/khal/settings/settings.py @@ -57,15 +57,15 @@ def find_configuration_file() -> Optional[str]: """Return the configuration filename. - This function builds the list of paths known by khal and then return the - first one which exists. The first paths searched are the ones described in - the XDG Base Directory Standard, e.g. ~/.config/khal/config. + Check all the paths for configuration files defined in the XDG Base Directory + Standard, and return the first one that exists, if any. + + For the common case, this will return ~/.config/khal/config, assuming that it + exists. """ - DEFAULT_PATH = __productname__ - paths = [os.path.join(path, DEFAULT_PATH, 'config') - for path in xdg.BaseDirectory.xdg_config_dirs] - for path in paths: + for dir in xdg.BaseDirectory.xdg_config_dirs: + path = os.path.join(dir, __productname__, 'config') if os.path.exists(path): return path