Skip to content

Commit

Permalink
Merge pull request #135 from FlowFuse/persistent-storage
Browse files Browse the repository at this point in the history
Ensure userDir/storage is created
  • Loading branch information
knolleary authored Jun 21, 2024
2 parents 3178ac5 + 55311cf commit 0b77ab0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions localfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async function createUserDirIfNeeded (userDir) {
logger.info(`Creating settings directory: ${userDir}`)
await fs.mkdir(userDir)
await fs.mkdir(path.join(userDir, 'node_modules'))
await fs.mkdir(path.join(userDir, 'storage'))
const packageJSON = {
name: 'flowfuse-node-red-project',
description: 'A FlowFuse Node-RED Instance',
Expand All @@ -46,6 +47,10 @@ async function createUserDirIfNeeded (userDir) {
JSON.stringify(packageJSON)
)
}
// "upgrade" exiting projects
if (!existsSync(path.join(userDir, 'storage'))) {
await fs.mkdir(path.join(userDir, 'storage'))
}
}

async function startProject (app, project, ProjectStack, userDir, port) {
Expand Down

0 comments on commit 0b77ab0

Please sign in to comment.