store/cockpitApi: make cache dir in case it doesn't exist

Pass `-p` when creating blueprint directories in case
`~/.cache/cockpit-image-builder` doesn't exist yet.
This commit is contained in:
Sanne Raymaekers 2025-01-30 13:03:17 +01:00
parent 40d1d4cd0f
commit 1f5afc6bc6

View file

@ -227,9 +227,10 @@ export const cockpitApi = emptyCockpitApi.injectEndpoints({
try {
const id = uuidv4();
const blueprintsDir = await getBlueprintsPath();
await cockpit.spawn(['mkdir', id], {
directory: blueprintsDir,
});
await cockpit.spawn(
['mkdir', '-p', path.join(blueprintsDir, id)],
{}
);
await cockpit
.file(path.join(blueprintsDir, id, `${id}.json`))
.replace(JSON.stringify(blueprintReq));