Commit 1771339e authored by Dan Pascu's avatar Dan Pascu

Simplified script path detection

parent 1aa3af29
...@@ -5,11 +5,8 @@ import sys ...@@ -5,11 +5,8 @@ import sys
# We need to mangle Python's import path in case blink is run directly from # We need to mangle Python's import path in case blink is run directly from
# the bin/ directory. # the bin/ directory.
try: script = globals().get('__file__', sys.argv[0])
__file__ script_dir = os.path.dirname(os.path.realpath(script))
except NameError:
__file__ = sys.argv[0]
script_dir = os.path.dirname(os.path.realpath(__file__))
parent_dir = os.path.dirname(script_dir) parent_dir = os.path.dirname(script_dir)
if os.path.basename(script_dir)=='bin' and os.path.exists(os.path.join(parent_dir, 'blink', '__init__.py')): if os.path.basename(script_dir)=='bin' and os.path.exists(os.path.join(parent_dir, 'blink', '__init__.py')):
# Insert the parent path just before the existing script's path. We need # Insert the parent path just before the existing script's path. We need
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment