INNER CODE UNIT · Python
find_astcenc
untoldengine/UntoldEngine · scripts/texbake.py:261
def find_astcenc() -> str:
"""
Locate the astcenc binary. Tries an explicit env var, the location
`untoldengine bootstrap` installs to, a shared Tools folder, then common
names on PATH.
Returns the binary name/path if found, raises RuntimeError otherwise.
"""
env_override = os.environ.get("ASTCENC_BIN")
if env_override:
astcenc_path = Path(env_override).expanduser()
if astcenc_path.is_file() and os.access(astcenc_path, os.X_OK):
return str(astcenc_path)
untoldengine_home = os.environ.get("UNTOLDENGINE_HOME")
home_root = Path(untoldengine_home).expanduser() if untoldengine_home else Path.home() / ".untoldengine"
bootstrap_candidate = home_root / "tools" / "astcenc" / "astcenc"
if bootstrap_candidate.is_file() and os.access(bootstrap_candidate, os.X_OK):
return str(bootstrap_candidate)