Files
Frobot-OTA-Agent/ota_agent/manifest_store.py
2026-04-23 14:40:29 +08:00

18 lines
525 B
Python

from __future__ import annotations
import json
from pathlib import Path
from .models import UpdateManifest
class ManifestStore:
def __init__(self, manifest_dir: str) -> None:
self.path = Path(manifest_dir)
self.path.mkdir(parents=True, exist_ok=True)
def save(self, manifest: UpdateManifest) -> Path:
target = self.path / f"{manifest.release_version}.json"
target.write_text(json.dumps(manifest.model_dump(), ensure_ascii=False, indent=2), encoding="utf-8")
return target