Merge pull request #8399 from Budibase/fix/initTmpDir

Ensure tmpDir/.budibase always exists
This commit is contained in:
Rory Powell 2022-10-26 09:37:25 +01:00 committed by GitHub
commit de1de66942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,6 @@
const { join } = require("path") const { join } = require("path")
const { tmpdir } = require("os") const { tmpdir } = require("os")
const fs = require("fs")
const env = require("../environment") const env = require("../environment")
/**************************************************** /****************************************************
@ -16,6 +17,11 @@ exports.ObjectStoreBuckets = {
PLUGINS: env.PLUGIN_BUCKET_NAME, PLUGINS: env.PLUGIN_BUCKET_NAME,
} }
exports.budibaseTempDir = function () { const bbTmp = join(tmpdir(), ".budibase")
return join(tmpdir(), ".budibase") if (!fs.existsSync(bbTmp)) {
fs.mkdirSync(bbTmp)
}
exports.budibaseTempDir = function () {
return bbTmp
} }