import "dotenv/config"; import fs from "fs"; import os from "os"; import path from "path"; export const FC2_COOKIE = process.env.FC2_COOKIE || ""; const expandHome = (p: string): string => { if (p.startsWith("~/")) return path.join(os.homedir(), p.slice(2)); if (p === "~") return os.homedir(); return p; }; export const resolveDbPath = (flag?: string): string => { const raw = flag || process.env.FC2CMA_DB || "~/.fc2cma/db.sqlite"; const full = path.resolve(expandHome(raw)); fs.mkdirSync(path.dirname(full), { recursive: true }); return full; };