summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/core/main.py5
2 files changed, 2 insertions, 5 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 6f4b76d0..92838a21 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -1086,6 +1086,8 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
             data['loading'] = False
             return path
 
+        if not os.path.exists(ranger.args.cachedir):
+            os.makedirs(ranger.args.cachedir)
         cacheimg = os.path.join(ranger.args.cachedir, self.sha1_encode(path))
         if self.settings.preview_images and \
                 os.path.isfile(cacheimg) and \
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 598ce243..17b546c0 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -145,11 +145,6 @@ def main(
             from ranger.ext import curses_interrupt_handler
             curses_interrupt_handler.install_interrupt_handler()
 
-        # Create cache directory
-        if fm.settings.preview_images and fm.settings.use_preview_script:
-            if not os.path.exists(args.cachedir):
-                os.makedirs(args.cachedir)
-
         if not args.clean:
             # Create data directory
             if not os.path.exists(args.datadir):