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

Method migrateDataIfNeeded

apps/desktop/main/index.ts:195–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

193
194 // 从旧目录迁移数据(Documents/ChatLab → userData/data)
195 migrateDataIfNeeded() {
196 if (needsLegacyMigration()) {
197 console.log('[Main] Legacy data migration needed, starting migration...')
198 const result = migrateFromLegacyDir()
199 if (result.success) {
200 console.log(`[Main] Migration completed. Migrated: ${result.migratedDirs.join(', ')}`)
201 } else {
202 console.error('[Main] Migration failed:', result.error)
203 }
204 } else {
205 console.log('[Main] No legacy data migration needed')
206 }
207 }
208
209 // 从 Electron 旧目录结构迁移到新的双根目录结构
210 migrateToUnifiedDirsIfNeeded() {

Callers 1

initMethod · 0.95

Calls 3

needsLegacyMigrationFunction · 0.90
migrateFromLegacyDirFunction · 0.90
errorMethod · 0.65

Tested by

no test coverage detected