Ensure data/, data/exports/, and data/downloads/ are created at startup
Add _ensure_data_dirs() helper in main.py and call it from both _run_setup() and _start_service() so all required data directories are guaranteed to exist before any module attempts to use them. https://claude.ai/code/session_01KjaNo9RXevw6x1DjJD8mj6
This commit is contained in:
@@ -82,6 +82,13 @@ def main(
|
|||||||
# Setup
|
# Setup
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def _ensure_data_dirs() -> None:
|
||||||
|
"""Create data/, data/exports/, and data/downloads/ if they don't exist."""
|
||||||
|
base = Path(__file__).parent / "data"
|
||||||
|
for sub in ("", "exports", "downloads"):
|
||||||
|
(base / sub).mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
def _run_setup() -> None:
|
def _run_setup() -> None:
|
||||||
if cfg.config_exists():
|
if cfg.config_exists():
|
||||||
overwrite = typer.confirm(
|
overwrite = typer.confirm(
|
||||||
@@ -90,6 +97,8 @@ def _run_setup() -> None:
|
|||||||
if not overwrite:
|
if not overwrite:
|
||||||
raise typer.Abort()
|
raise typer.Abort()
|
||||||
|
|
||||||
|
_ensure_data_dirs()
|
||||||
|
|
||||||
# Ensure the export CLI is present before finishing setup
|
# Ensure the export CLI is present before finishing setup
|
||||||
try:
|
try:
|
||||||
tools.ensure_export_cli()
|
tools.ensure_export_cli()
|
||||||
@@ -110,6 +119,8 @@ def _run_setup() -> None:
|
|||||||
def _start_service(run_now: bool = False) -> None:
|
def _start_service(run_now: bool = False) -> None:
|
||||||
global _master_password
|
global _master_password
|
||||||
|
|
||||||
|
_ensure_data_dirs()
|
||||||
|
|
||||||
# Verify the export CLI is present (offers download if missing)
|
# Verify the export CLI is present (offers download if missing)
|
||||||
try:
|
try:
|
||||||
tools.ensure_export_cli()
|
tools.ensure_export_cli()
|
||||||
|
|||||||
Reference in New Issue
Block a user