From 3531f1e49d890a75fec3ca6a2ddc773832b1b6a5 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 22 Jun 2010 02:16:17 +0200 Subject: ranger.__init__: added relpath_script --- ranger/__init__.py | 12 ++++++++++++ ranger/api/options.py | 2 +- ranger/defaults/options.py | 2 +- 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 -- cgit 1.4.1-2-gfad0