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

Function isExistingUserDataDir

packages/node-runtime/src/data-dir-switch.ts:120–129  ·  view source on GitHub ↗
(dirPath: string)

Source from the content-addressed store, hash-verified

118}
119
120export function isExistingUserDataDir(dirPath: string): boolean {
121 if (!fs.existsSync(dirPath)) return false
122
123 try {
124 const entries = fs.readdirSync(dirPath)
125 return hasChatLabUserDataStructure(entries) || hasChatLabDatabaseFiles(dirPath, entries)
126 } catch {
127 return false
128 }
129}
130
131export function isUserDataDirSafeToUse(dirPath: string): boolean {
132 if (!fs.existsSync(dirPath)) return true

Callers 3

cleanupPendingDeleteDirFunction · 0.85

Calls 2

hasChatLabDatabaseFilesFunction · 0.85

Tested by

no test coverage detected