()
| 530 | } |
| 531 | |
| 532 | function initRuntime() { |
| 533 | let config = loadConfig() |
| 534 | const pendingMigration = applyPendingNodeDataDirMigrationIfNeeded() |
| 535 | if (!pendingMigration.skipped) { |
| 536 | if (pendingMigration.success) { |
| 537 | console.log('[Migration] Pending data directory migration completed') |
| 538 | config = loadConfig() |
| 539 | } else { |
| 540 | console.error('[Migration] Pending data directory migration failed:', pendingMigration.error) |
| 541 | } |
| 542 | } |
| 543 | const userDataDir = config.data.user_data_dir || undefined |
| 544 | const pathProvider = new NodePathProvider(userDataDir) |
| 545 | pathProvider.ensureAllDirs() |
| 546 | const runtime = assertCliDataDirCompatible(pathProvider, 'cli') |
| 547 | |
| 548 | if (hasPendingElectronDataWarning() || !verifyCliDataPath(pathProvider.getDatabaseDir())) { |
| 549 | printElectronDataError() |
| 550 | process.exit(1) |
| 551 | } |
| 552 | |
| 553 | const nativeBinding = resolveNativeBinding() |
| 554 | const dbManager = new DatabaseManager(pathProvider, { nativeBinding, runtime }) |
| 555 | return { config, pathProvider, dbManager } |
| 556 | } |
| 557 | |
| 558 | function printElectronDataError(): void { |
| 559 | console.error('\n' + '='.repeat(68)) |
no test coverage detected