mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-24 10:09:20 +01:00
init.py: __file__ path is properly set for scripts run with Alt-9
This commit is contained in:
parent
b0d8723ccb
commit
9876c4ffa7
@ -59,8 +59,17 @@ def runscript(script):
|
|||||||
watchdog.reset()
|
watchdog.reset()
|
||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
sys.argv = [ script ]
|
sys.argv = [ script ]
|
||||||
execfile(script, globals())
|
# Adjust the __file__ path in the globals we pass to the script
|
||||||
sys.argv = argv
|
g = globals()
|
||||||
|
old__file__ = g['__file__']
|
||||||
|
g['__file__'] = script
|
||||||
|
try:
|
||||||
|
execfile(script, g)
|
||||||
|
except:
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
g['__file__'] = old__file__
|
||||||
|
|
||||||
|
|
||||||
def print_banner():
|
def print_banner():
|
||||||
version1 = "Python interpreter version %d.%d.%d %s (serial %d)" % sys.version_info
|
version1 = "Python interpreter version %d.%d.%d %s (serial %d)" % sys.version_info
|
||||||
|
Loading…
Reference in New Issue
Block a user