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 { try {
const id = uuidv4(); const id = uuidv4();
const blueprintsDir = await getBlueprintsPath(); const blueprintsDir = await getBlueprintsPath();
await cockpit.spawn(['mkdir', id], { await cockpit.spawn(
directory: blueprintsDir, ['mkdir', '-p', path.join(blueprintsDir, id)],
}); {}
);
await cockpit await cockpit
.file(path.join(blueprintsDir, id, `${id}.json`)) .file(path.join(blueprintsDir, id, `${id}.json`))
.replace(JSON.stringify(blueprintReq)); .replace(JSON.stringify(blueprintReq));