summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-10 02:51:13 +0100
committerhut <hut@lavabit.com>2013-02-10 02:51:13 +0100
commit184e84284d2f4e48631a4b94b87ba76126470206 (patch)
tree9233b3c7826e469de878f5456bde23656643bdcb
parent2f518f737769b9e8fd97651d4bbc64d89b4b4865 (diff)
downloadranger-184e84284d2f4e48631a4b94b87ba76126470206.tar.gz
core.actions: Warn about missing or non-executable scope.sh
-rw-r--r--ranger/core/actions.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 5ffe315e..491f22af 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -10,6 +10,7 @@ import tempfile
 from os.path import join, isdir, realpath, exists
 from os import link, symlink, getcwd, listdir, stat
 from inspect import cleandoc
+from stat import S_IEXEC
 
 import ranger
 from ranger.ext.direction import Direction
@@ -817,9 +818,22 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 				if data['loading']:
 					return None
 
+
 			found = data.get((-1, -1), data.get((width, -1),
 				data.get((-1, height), data.get((width, height), False))))
 			if found == False:
+				try:
+					stat_ = os.stat(self.settings.preview_script)
+				except:
+					self.fm.notify("Preview Script `%s' doesn't exist!" %
+							self.settings.preview_script, bad=True)
+					return None
+
+				if not stat_.st_mode & S_IEXEC:
+					self.fm.notify("Preview Script `%s' is not executable!" %
+							self.settings.preview_script, bad=True)
+					return None
+
 				data['loading'] = True
 				loadable = CommandLoader(args=[self.settings.preview_script,
 					path, str(width), str(height)], read=True,