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

Function hasChatLabDatabaseFiles

packages/node-runtime/src/data-dir-switch.ts:108–118  ·  view source on GitHub ↗
(dirPath: string, entries?: string[])

Source from the content-addressed store, hash-verified

106}
107
108function hasChatLabDatabaseFiles(dirPath: string, entries?: string[]): boolean {
109 const dirEntries = entries ?? fs.readdirSync(dirPath)
110 if (!dirEntries.includes('databases')) return false
111
112 const dbDir = path.join(dirPath, 'databases')
113 try {
114 return fs.existsSync(dbDir) && fs.readdirSync(dbDir).some((file) => file.endsWith('.db'))
115 } catch {
116 return false
117 }
118}
119
120export function isExistingUserDataDir(dirPath: string): boolean {
121 if (!fs.existsSync(dirPath)) return false

Callers 2

isExistingUserDataDirFunction · 0.85
isUserDataDirSafeToUseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected