diff options
author | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2017-10-07 16:42:48 +0200 |
---|---|---|
committer | Wojciech Siewierski <wojciech.siewierski@onet.pl> | 2017-10-07 17:04:04 +0200 |
commit | d9798f80aac020232d97bdd04a18fb79ca4156fa (patch) | |
tree | d5e5187a8bb9859ac0756f4235ca5e4e54edfd73 /ranger | |
parent | c02a5e379250c55542e2b662ae887c75f40677ee (diff) | |
download | ranger-d9798f80aac020232d97bdd04a18fb79ca4156fa.tar.gz |
If the user config is not available, always load the global one
Ignore the RANGER_LOAD_DEFAULT_RC environmental variable if the user config doesn't exist or is unreadable because not loading any config would result in an unusable ranger instance.
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/main.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ranger/core/main.py b/ranger/core/main.py index 3f4f068a..0148e2b5 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -396,9 +396,11 @@ def load_settings( # pylint: disable=too-many-locals,too-many-branches,too-many custom_conf = fm.confpath('rc.conf') default_conf = fm.relpath('config', 'rc.conf') - if os.environ.get('RANGER_LOAD_DEFAULT_RC', 'TRUE').upper() != 'FALSE': + custom_conf_is_readable = os.access(custom_conf, os.R_OK) + if (os.environ.get('RANGER_LOAD_DEFAULT_RC', 'TRUE').upper() != 'FALSE' or + not custom_conf_is_readable): fm.source(default_conf) - if os.access(custom_conf, os.R_OK): + if custom_conf_is_readable: fm.source(custom_conf) else: |