MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / needsUnifiedDirMigration

Function needsUnifiedDirMigration

apps/desktop/main/paths.ts:587–602  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

585 * Electron 启动并写入了默认值 ~/.chatlab/data,导致迁移被跳过。
586 */
587export function needsUnifiedDirMigration(): boolean {
588 const config = loadConfig()
589 if (config.data.electron_migration_done) return false
590
591 const oldDataDir = resolveOldElectronDataDir()
592 const oldDbDir = path.join(oldDataDir, 'databases')
593 if (!fs.existsSync(oldDbDir)) return false
594
595 const hasDb = fs.readdirSync(oldDbDir).some((f) => f.endsWith('.db'))
596 if (!hasDb) return false
597
598 const currentUserDataDir = config.data.user_data_dir || getDefaultUserDataDir()
599 if (path.resolve(currentUserDataDir) === path.resolve(oldDataDir)) return false
600
601 return true
602}
603
604/**
605 * 解析 Electron 旧数据目录(考虑 storage.json 自定义路径)

Callers 1

Calls 3

loadConfigFunction · 0.90
getDefaultUserDataDirFunction · 0.85

Tested by

no test coverage detected