fix(conductor): Resolve FileExistsError and harden Preset Manager modal
This commit is contained in:
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user