(projectRoot: string)
| 178 | * deletes the file. |
| 179 | */ |
| 180 | export function hasForeignDbFile(projectRoot: string): boolean { |
| 181 | const dbPath = path.join(getCodeGraphDir(projectRoot), 'codegraph.db'); |
| 182 | let st: fs.Stats; |
| 183 | try { st = fs.statSync(dbPath); } catch { return false; } |
| 184 | return st.isFile() && st.size > 0 && probeSchema(dbPath) === 'not-sqlite'; |
| 185 | } |
| 186 | |
| 187 | /** A SQLite file header is 100 bytes; anything shorter cannot hold a schema. */ |
| 188 | const SQLITE_HEADER_SIZE = 100; |
no test coverage detected