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 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) => {
});
}
});
})
});
}