diff options
author | hut <hut@lavabit.com> | 2010-06-22 01:42:53 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-06-22 01:42:53 +0200 |
commit | 48a13dcdb31313d74e71028a32e19041f3a7f76c (patch) | |
tree | 47c8c71eb4f4b5a35d1be50fba0f8ed06556caf6 | |
parent | d5ba00761ed55e9f5c18b71c7eae546eb4056844 (diff) | |
download | ranger-48a13dcdb31313d74e71028a32e19041f3a7f76c.tar.gz |
main: copy scope.sh to ~/.ranger on first start
-rw-r--r-- | ranger/__main__.py | 12 | ||||
-rw-r--r-- | ranger/defaults/options.py | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py index ac6b2362..048e00b9 100644 --- a/ranger/__main__.py +++ b/ranger/__main__.py @@ -22,7 +22,7 @@ # convenient exception handling in ranger.py (ImportError) import locale -import os +import os.path import sys def parse_arguments(): @@ -60,6 +60,13 @@ def parse_arguments(): return arg +def copy_config_files(): + import shutil + from ranger import relpath, relpath_conf + if not os.path.exists(relpath_conf('scope.sh')): + shutil.copy(relpath('data', 'scope.sh'), relpath_conf('scope.sh')) + + def allow_access_to_confdir(confdir, allow): if allow: try: @@ -200,6 +207,9 @@ def main(): else: path = '.' + if not ranger.arg.clean: + copy_config_files() + crash_traceback = None try: # Initialize objects diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py index 6e840e33..63b1e1a7 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('data/scope.sh') # relative to rangers path +preview_script = relpath_conf('scope.sh') # relative to config directory # Show dotfiles in the bookmark preview box? show_hidden_bookmarks = True |