From 9b038ceb8a8d2e37acc121ae38b149124bb91e41 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Wed, 26 Oct 2022 09:24:28 +0100 Subject: [PATCH] Ensure tmpDir/.budibase always exists --- packages/backend-core/src/objectStore/utils.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/backend-core/src/objectStore/utils.js b/packages/backend-core/src/objectStore/utils.js index 9cf4f5f70e..2d4faf55d1 100644 --- a/packages/backend-core/src/objectStore/utils.js +++ b/packages/backend-core/src/objectStore/utils.js @@ -1,5 +1,6 @@ const { join } = require("path") const { tmpdir } = require("os") +const fs = require("fs") const env = require("../environment") /**************************************************** @@ -16,6 +17,11 @@ exports.ObjectStoreBuckets = { PLUGINS: env.PLUGIN_BUCKET_NAME, } -exports.budibaseTempDir = function () { - return join(tmpdir(), ".budibase") +const bbTmp = join(tmpdir(), ".budibase") +if (!fs.existsSync(bbTmp)) { + fs.mkdirSync(bbTmp) +} + +exports.budibaseTempDir = function () { + return bbTmp }