summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-04-04 21:52:41 +0200
committerhut <hut@lavabit.com>2011-04-04 21:52:41 +0200
commit47c394e3836699c5920965fee4c20d7a20343b32 (patch)
tree3e7a008c978731d9c8307a31e5a9d28f140ba60d
parent70f876d5306a2d808de4ae27e7f5f20377d6255c (diff)
downloadranger-47c394e3836699c5920965fee4c20d7a20343b32.tar.gz
improved ranger.py
-rwxr-xr-xranger.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/ranger.py b/ranger.py
index 240b3687..16c6b1b5 100755
--- a/ranger.py
+++ b/ranger.py
@@ -34,9 +34,10 @@ return 1
 """
 
 import sys
+import os.path
 
-# When using the --clean option, not even bytecode should be written.
-# Thus, we need to find out if --clean is used as soon as possible.
+# Need to find out whether or not the flag --clean was used ASAP,
+# because --clean is supposed to disable bytecode compilation
 try:
 	argv = sys.argv[0:sys.argv.index('--')]
 except:
@@ -46,6 +47,13 @@ sys.dont_write_bytecode = '-c' in argv or '--clean' in argv
 # Set the actual docstring
 __doc__ = """Ranger - file browser for the unix terminal"""
 
+# Don't import ./ranger when running an installed binary at /usr/bin/ranger
+if os.path.isdir('ranger'):
+	try:
+		sys.path.remove(os.path.abspath('.'))
+	except ValueError:
+		pass
+
 # Start ranger
 import ranger
 sys.exit(ranger.main())