summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@hut.pm>2019-02-05 22:22:51 +0100
committerhut <hut@hut.pm>2019-02-05 22:25:22 +0100
commit3963d9b8d56e39ff97b957ad58587bb562bdbe60 (patch)
tree412258c2d445e73c6bf9ed94f4317584b0f995e4
parente3f89a7cb90d43217eb6fa041d4e4c45af20e786 (diff)
downloadranger-3963d9b8d56e39ff97b957ad58587bb562bdbe60.tar.gz
Ensure that `--clean` doesn't require writable confdir
-rw-r--r--ranger/core/actions.py4
-rw-r--r--ranger/core/main.py11
2 files changed, 12 insertions, 3 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 92838a21..ddb98d9b 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -1086,6 +1086,10 @@ 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 d6b8ac30..6fdd5366 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -321,9 +321,14 @@ def parse_arguments():
             sys.exit(1)
         return path
 
-    args.cachedir = path_init('cachedir')
-    args.confdir = path_init('confdir')
-    args.datadir = path_init('datadir')
+    if args.clean:
+        args.cachedir = None
+        args.confdir = None
+        args.datadir = None
+    else:
+        args.cachedir = path_init('cachedir')
+        args.confdir = path_init('confdir')
+        args.datadir = path_init('datadir')
     if args.choosefile:
         args.choosefile = path_init('choosefile')
     if args.choosefiles: