import path from 'path'; import { fileURLToPath } from 'url'; import { getDatabasePath, migrateSavesToDatabase } from './db.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const PROJECT_ROOT = path.resolve(__dirname, '..'); const SAVES_DIR = path.resolve(process.env.SAVES_DIR || path.join(PROJECT_ROOT, 'saves')); try { const migrated = await migrateSavesToDatabase(SAVES_DIR); console.log(`Migrated ${migrated.length} save files into SQLite.`); console.log(`SQLite database: ${getDatabasePath()}`); } catch (error) { console.error('Failed to migrate saves into SQLite.', error); process.exitCode = 1; }