summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-06-22 02:16:17 +0200
committerhut <hut@lavabit.com>2010-06-22 02:16:17 +0200
commit3531f1e49d890a75fec3ca6a2ddc773832b1b6a5 (patch)
treebabb116491995b6f4003c6ceb831d97281e004d7
parent356726c41d5f7a95fdf60ed867f05d2d10bff70a (diff)
downloadranger-3531f1e49d890a75fec3ca6a2ddc773832b1b6a5.tar.gz
ranger.__init__: added relpath_script
-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