python/events/python_init.py
raw| 1 | import Crossfire |
| 2 | import os.path |
| 3 | import sys |
| 4 | |
| 5 | Crossfire.Log(Crossfire.LogDebug, "Running python initialize script.") |
| 6 | sys.path.insert(0, os.path.join(Crossfire.DataDirectory(), Crossfire.MapDirectory(), 'python')) |
| 7 | |
| 8 | path = os.path.join(Crossfire.DataDirectory(), Crossfire.MapDirectory(), 'python/events/init') |
| 9 | |
| 10 | if os.path.exists(path): |
| 11 | scripts = os.listdir(path) |
| 12 | |
| 13 | for script in scripts: |
| 14 | if (script.endswith('.py')): |
| 15 | exec(open(os.path.join(path, script)).read()) |