summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/__main__.py12
-rw-r--r--ranger/defaults/options.py2
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