Files
llamamod/tools/lamapaths.py
T

32 lines
1.3 KiB
Python

"""Where the Python tools look for the original game files (all overridable by environment variables).
LLAMAMOD_CD folder with the CD contents (wads/, music/, *.cor ...),
default $LAMA_WINEPREFIX/iso-dk/Setup/Eng/Cd
LAMA_WINEPREFIX Wine prefix of a hand-made game setup (lamatest.py, levelbuild.py --install),
default ~/.wine-lama
LAMA_MOD the lama-mod script, default ~/.local/bin/lama-mod, else tools/lama-mod
"""
import os
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
WINEPREFIX = os.path.expanduser(os.environ.get('LAMA_WINEPREFIX') or '~/.wine-lama')
CD = os.path.expanduser(os.environ.get('LLAMAMOD_CD') or os.path.join(WINEPREFIX, 'iso-dk', 'Setup', 'Eng', 'Cd'))
CD_WADS = os.path.join(CD, 'wads')
TESTLEVEL_WAD = os.path.join(WINEPREFIX, 'mods', 'testlevel', 'wads', 'T1L9M001.wad')
def lama_mod():
p = os.environ.get('LAMA_MOD')
if p:
return os.path.expanduser(p)
p = os.path.expanduser('~/.local/bin/lama-mod')
return p if os.path.exists(p) else os.path.join(HERE, 'lama-mod')
def need(path, what, hint):
"""Exit with a clear message if PATH does not exist."""
if not os.path.exists(path):
sys.exit('%s not found: %s (%s)' % (what, path, hint))
return path