Lumi/plugins/lumi_transcription/backend/paths.js
2026-07-22 11:01:49 +02:00

8 lines
559 B
JavaScript

const fs = require("fs");
const path = require("path");
const ROOT = path.resolve(__dirname, "..");
const DATA = path.join(ROOT, "data");
function ensureDataDirs() { for (const name of ["logs", "models", "runtime", "tmp"]) fs.mkdirSync(path.join(DATA, name), { recursive: true }); }
function dataPath(...parts) { const target = path.resolve(DATA, ...parts); if (target !== DATA && !target.startsWith(`${DATA}${path.sep}`)) throw new Error("Path escapes transcription plugin data."); return target; }
module.exports = { ROOT, DATA, ensureDataDirs, dataPath };