summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-30 14:22:10 +0100
committerhut <hut@lavabit.com>2009-12-30 14:22:10 +0100
commit524d95e19c05830848567b586c0df6dba5c28e75 (patch)
tree00b8a3f47b8b748078e305582822e42e5b5673d1
parentd00083250fefaabb8df5e97256e03411beac06b4 (diff)
downloadranger-524d95e19c05830848567b586c0df6dba5c28e75.tar.gz
allow to start the program by runnung the directory
-rw-r--r--ranger/__init__.py6
-rw-r--r--ranger/__main__.py2
-rw-r--r--ranger/applications.py6
3 files changed, 9 insertions, 5 deletions
diff --git a/ranger/__init__.py b/ranger/__init__.py
index 264aa931..4dfec83a 100644
--- a/ranger/__init__.py
+++ b/ranger/__init__.py
@@ -2,6 +2,9 @@
 import os
 import sys
 
+# for easier access
+from ranger.ext.debug import log, trace
+
 __copyright__ = 'none'
 __license__ = 'GPL'
 __version__ = '1.0.0'
@@ -17,7 +20,4 @@ sys.path.append(CONFDIR)
 
 USAGE = '''%s [options] [path/filename]'''
 
-# for easier access
-from ranger.ext.debug import log, trace
-
 from ranger.__main__ import main
diff --git a/ranger/__main__.py b/ranger/__main__.py
index 200d856b..c821a23c 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -76,4 +76,6 @@ def main():
 			except: pass
 
 if __name__ == '__main__':
+	top_dir = os.path.dirname(sys.path[0])
+	sys.path.insert(0, top_dir)
 	main()
diff --git a/ranger/applications.py b/ranger/applications.py
index 4c329a05..beefba9f 100644
--- a/ranger/applications.py
+++ b/ranger/applications.py
@@ -6,6 +6,10 @@ p: redirect output to the pager
 
 An uppercase key ensures that a certain flag will not be used.
 """
+
+import os, sys
+from ranger.ext.waitpid_no_intr import waitpid_no_intr
+
 ALLOWED_FLAGS = 'sdpSDP'
 
 class Applications(object):
@@ -24,14 +28,12 @@ class Applications(object):
 		"""Returns a list with all application functions"""
 		return [x[4:] for x in self.__class__.__dict__ if x.startswith('app_')]
 
-import os, sys
 null = open(os.devnull, 'a')
 
 def run(*args, **kw):
 	"""Run files with the specified parameters"""
 	from subprocess import Popen
 	from subprocess import PIPE
-	from ranger.ext.waitpid_no_intr import waitpid_no_intr
 
 	flags, fm = kw['flags'], kw['fm']
 	for flag in flags: