about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/__init__.py12
-rw-r--r--ranger/api/options.py2
-rw-r--r--ranger/defaults/options.py2
3 files changed, 14 insertions, 2 deletions
diff --git a/ranger/__init__.py b/ranger/__init__.py
index 4fcc2ecf..54baa3c0 100644
--- a/ranger/__init__.py
+++ b/ranger/__init__.py
@@ -61,6 +61,18 @@ def relpath_conf(*paths):
 	else:
 		return os.path.join(arg.confdir, *paths)
 
+def relpath_script(*paths):
+	"""
+	Returns the path relative to where scripts are stored.
+
+	It's relpath('data', *paths) with the --clean flag and
+	relpath_conf(*paths) without --clean.
+	"""
+	if arg.clean:
+		return relpath('data', *paths)
+	else:
+		return relpath_conf(*paths)
+
 def relpath(*paths):
 	"""returns the path relative to rangers library directory"""
 	return os.path.join(RANGERDIR, *paths)
diff --git a/ranger/api/options.py b/ranger/api/options.py
index aee6150b..93da4df1 100644
--- a/ranger/api/options.py
+++ b/ranger/api/options.py
@@ -17,4 +17,4 @@ import re
 from re import compile as regexp
 from ranger.api import *
 from ranger.gui import color
-from ranger import relpath, relpath_conf
+from ranger import relpath, relpath_conf, relpath_script
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index 63b1e1a7..67009426 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -40,7 +40,7 @@ hidden_filter = regexp(
 show_hidden = False
 
 # Which script is used to generate file previews?
-preview_script = relpath_conf('scope.sh')  # relative to config directory
+preview_script = relpath_script('scope.sh')  # relative to config directory
 
 # Show dotfiles in the bookmark preview box?
 show_hidden_bookmarks = True
/div>
20
21
22
23
24
25
26