(dirPath: string)
| 129 | } |
| 130 | |
| 131 | export function isUserDataDirSafeToUse(dirPath: string): boolean { |
| 132 | if (!fs.existsSync(dirPath)) return true |
| 133 | |
| 134 | try { |
| 135 | const entries = fs.readdirSync(dirPath) |
| 136 | if (entries.length === 0) return true |
| 137 | return hasChatLabUserDataStructure(entries) || hasChatLabDatabaseFiles(dirPath, entries) |
| 138 | } catch { |
| 139 | return false |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | export function isDirectoryEmptyOrMissing(dirPath: string): boolean { |
| 144 | if (!fs.existsSync(dirPath)) return true |
no test coverage detected