Ensuring the radio presets dir exists

This commit is contained in:
Logan Cusano
2024-05-13 01:12:36 -04:00
parent aa4de9f326
commit c240007c2b

View File

@@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path'; import path from 'path';
import express from 'express'; import express from 'express';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { generateUniqueID } from '../../modules/baseUtils.mjs'; import { generateUniqueID, ensureDirectoryExists } from '../../modules/baseUtils.mjs';
import { restartApplication } from '../../modules/selfUpdater.mjs' import { restartApplication } from '../../modules/selfUpdater.mjs'
import { launchProcess } from '../../modules/subprocessHandler.mjs' import { launchProcess } from '../../modules/subprocessHandler.mjs'
@@ -145,6 +145,10 @@ const exportSystems = (systemsData) => {
whitelistFile: system.whitelistFile || '' whitelistFile: system.whitelistFile || ''
} }
)); ));
// Ensure directory exists
ensureDirectoryExists(radioPresetsPath);
return new Promise(res => { return new Promise(res => {
fs.access(radioPresetsPath, fs.constants.F_OK, (err) => { fs.access(radioPresetsPath, fs.constants.F_OK, (err) => {
if (err) { if (err) {
@@ -171,5 +175,5 @@ const exportSystems = (systemsData) => {
}); });
} }
}); });
}) });
} }