From c240007c2b5d177dbea62c273065eef305bd933f Mon Sep 17 00:00:00 2001 From: Logan Cusano Date: Mon, 13 May 2024 01:12:36 -0400 Subject: [PATCH] Ensuring the radio presets dir exists --- express/routes/setupRoutes.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/express/routes/setupRoutes.js b/express/routes/setupRoutes.js index 88d55e2..9eed259 100644 --- a/express/routes/setupRoutes.js +++ b/express/routes/setupRoutes.js @@ -2,7 +2,7 @@ import fs from 'fs'; import path from 'path'; import express from 'express'; import { fileURLToPath } from 'url'; -import { generateUniqueID } from '../../modules/baseUtils.mjs'; +import { generateUniqueID, ensureDirectoryExists } from '../../modules/baseUtils.mjs'; import { restartApplication } from '../../modules/selfUpdater.mjs' import { launchProcess } from '../../modules/subprocessHandler.mjs' @@ -145,6 +145,10 @@ const exportSystems = (systemsData) => { whitelistFile: system.whitelistFile || '' } )); + + // Ensure directory exists + ensureDirectoryExists(radioPresetsPath); + return new Promise(res => { fs.access(radioPresetsPath, fs.constants.F_OK, (err) => { if (err) { @@ -171,5 +175,5 @@ const exportSystems = (systemsData) => { }); } }); - }) + }); } \ No newline at end of file