diff options
author | toonn <toonn@toonn.io> | 2019-12-21 17:22:26 +0100 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2019-12-21 17:28:58 +0100 |
commit | 9b7f70b5183f1e0680b3dc61d16906bcad236f4e (patch) | |
tree | 9cd72c310fc779b48439777c29b2dbd44af030d7 /ranger | |
parent | ef78df5d408e243c33fce9733488201ef96c5748 (diff) | |
download | ranger-9b7f70b5183f1e0680b3dc61d16906bcad236f4e.tar.gz |
Restore access to a preview cache in clean mode
`--clean` is incredibly useful when testing contributions to `scope.sh` among other things but some (most?) previews require the cache to function. As a compromise every invocation using `--clean` will create a temporary cache directory. Fixes #1783
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/core/actions.py | 4 | ||||
-rw-r--r-- | ranger/core/main.py | 3 |
2 files changed, 2 insertions, 5 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py index 18302431..cd6c6afe 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -1118,10 +1118,6 @@ class Actions( # pylint: disable=too-many-instance-attributes,too-many-public-m data['loading'] = False return path - if ranger.args.clean: - # Don't access args.cachedir in clean mode - return None - if not os.path.exists(ranger.args.cachedir): os.makedirs(ranger.args.cachedir) cacheimg = os.path.join(ranger.args.cachedir, self.sha1_encode(path)) diff --git a/ranger/core/main.py b/ranger/core/main.py index aefaacbc..7322a501 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -333,7 +333,8 @@ def parse_arguments(): return path if args.clean: - args.cachedir = None + from tempfile import mkdtemp + args.cachedir = mkdtemp(suffix='.ranger-cache') args.confdir = None args.datadir = None else: |