diff --git a/src/server/db/db.ts b/src/server/db/db.ts index b932223..e9c094b 100644 --- a/src/server/db/db.ts +++ b/src/server/db/db.ts @@ -8,11 +8,15 @@ import * as fs from "fs"; if (fs.existsSync("sqlite.db")) { console.log("DB not in data directory! Moving..."); - fs.mkdirSync("data"); + if (!fs.existsSync("data")) { + fs.mkdirSync("data"); + } fs.renameSync("sqlite.db", "data/sqlite.db"); } else if (!fs.existsSync("data/sqlite.db") && !fs.existsSync("sqlite.db")) { console.log("Couldn't find DB copying from assets..."); - fs.mkdirSync("data"); + if (!fs.existsSync("data")) { + fs.mkdirSync("data"); + } fs.copyFileSync("assets/sqlite.db", "data/sqlite.db"); }