diff options
-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()) |