diff options
author | hut <hut@lavabit.com> | 2011-04-04 21:52:41 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2011-04-05 17:03:57 +0200 |
commit | d8084b41f67b1b8470251633529cacf2ba07fb6a (patch) | |
tree | 45dbb95b6ed4723804ca4fef2cb62a34c50f125a | |
parent | c9023dbd5bee393da3f0913a2977f717270426af (diff) | |
download | ranger-d8084b41f67b1b8470251633529cacf2ba07fb6a.tar.gz |
improved ranger.py
-rwxr-xr-x | ranger.py | 12 |
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()) |