update
This commit is contained in:
16
backend/paths.py
Normal file
16
backend/paths.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from pathlib import Path
|
||||
|
||||
from config import STORAGE_DIR, PROJECTS_DIR
|
||||
|
||||
|
||||
def safe_basename(topic: str, format_name: str) -> str:
|
||||
clean = topic.replace("/", "_").replace("\x00", "")
|
||||
return f"{clean} - {format_name}"
|
||||
|
||||
|
||||
def final_html_path(topic: str, format_name: str) -> Path:
|
||||
return STORAGE_DIR / "html" / f"{safe_basename(topic, format_name)}.html"
|
||||
|
||||
|
||||
def project_dir(name: str) -> Path:
|
||||
return PROJECTS_DIR / name
|
||||
Reference in New Issue
Block a user