Commit 15ed1284 authored by Eric Duminil's avatar Eric Duminil
Browse files

Look for bundled templates too

parent d17f078f
...@@ -63,9 +63,12 @@ def get_simstadt_folder() -> Path: ...@@ -63,9 +63,12 @@ def get_simstadt_folder() -> Path:
def get_template_path() -> Path: def get_template_path() -> Path:
if "SIMSTADT_TEMPLATE_PATH" in os.environ: if "SIMSTADT_TEMPLATE_PATH" in os.environ:
return Path(os.environ["SIMSTADT_TEMPLATE_PATH"]) return Path(os.environ["SIMSTADT_TEMPLATE_PATH"])
fallback = Path.cwd() / "templates" local_templates = Path.cwd() / "templates"
if fallback.exists(): if local_templates.exists():
return fallback return local_templates
bundled = Path(__file__).parent / "templates"
if bundled.exists():
return bundled
raise ValueError( raise ValueError(
"No template path found. Set SIMSTADT_TEMPLATE_PATH or create a templates/ directory." "No template path found. Set SIMSTADT_TEMPLATE_PATH or create a templates/ directory."
) )
......
Supports Markdown
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