fix(conductor): Resolve FileExistsError and harden Preset Manager modal

This commit is contained in:
2026-03-09 22:59:22 -04:00
parent 451d19126f
commit 178a694e2a
7 changed files with 110 additions and 84 deletions

View File

@@ -84,6 +84,8 @@ class PresetManager:
return {"presets": {}}
def _save_file(self, path: Path, data: Dict[str, Any]) -> None:
if path.parent.exists() and path.parent.is_file():
raise ValueError(f"Cannot save to {path}: Parent directory {path.parent} is a file. The project root seems to be a file.")
path.parent.mkdir(parents=True, exist_ok=True)
with open(path, "wb") as f:
f.write(tomli_w.dumps(data).encode("utf-8"))