diff options
author | hut <hut@lepus.uberspace.de> | 2016-02-24 22:10:13 +0100 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2016-02-24 22:10:13 +0100 |
commit | 24d5eb069dbe77e7755acf0a9ab8c8c153616642 (patch) | |
tree | 3c6c8f6a2b13f3cf16509e294291e27caa5dac3d | |
parent | c79354b980f3f1b2de98b5fa5a8faead6673fc3d (diff) | |
download | ranger-24d5eb069dbe77e7755acf0a9ab8c8c153616642.tar.gz |
ranger.__init__: avoid crashing when opening LOGFILE
-rw-r--r-- | ranger/__init__.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ranger/__init__.py b/ranger/__init__.py index 20c8ab35..6d16cc5e 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -25,11 +25,15 @@ TIME_BEFORE_FILE_BECOMES_GARBAGE = 1200 MAX_RESTORABLE_TABS = 3 MACRO_DELIMITER = '%' DEFAULT_PAGER = 'less' -LOGFILE = tempfile.gettempdir()+'/ranger_errorlog' CACHEDIR = os.path.expanduser("~/.cache/ranger") USAGE = '%prog [options] [path]' VERSION = 'ranger-master %s\n\nPython %s' % (__version__, sys.version) +try: + LOGFILE = tempfile.gettempdir()+'/ranger_errorlog' +except FileNotFoundError: + LOGFILE = '/dev/null' + # If the environment variable XDG_CONFIG_HOME is non-empty, CONFDIR is ignored # and the configuration directory will be $XDG_CONFIG_HOME/ranger instead. CONFDIR = '~/.config/ranger' |