Count project index .db files in the cache directory (internal stores excluded). */
| 10593 | |
| 10594 | /* Count project index .db files in the cache directory (internal stores excluded). */ |
| 10595 | static int count_db_indexes(const char *home) { |
| 10596 | const char *cache_dir = get_cache_dir(home); |
| 10597 | if (!cache_dir) { |
| 10598 | return 0; |
| 10599 | } |
| 10600 | cbm_dir_t *d = cbm_opendir(cache_dir); |
| 10601 | if (!d) { |
| 10602 | return 0; |
| 10603 | } |
| 10604 | int count = 0; |
| 10605 | cbm_dirent_t *ent; |
| 10606 | while ((ent = cbm_readdir(d)) != NULL) { |
| 10607 | if (cbm_is_project_index_db(ent->name)) { |
| 10608 | count++; |
| 10609 | } |
| 10610 | } |
| 10611 | cbm_closedir(d); |
| 10612 | return count; |
| 10613 | } |
| 10614 | |
| 10615 | /* Handle pre-existing indexes during (re)install (#607). |
| 10616 | * |
no test coverage detected