Skip trying to index deleted files, folders from Desktop app

Previously app would crash on startup if desktop app was told to
index a file that had been deleted afterwards
This commit is contained in:
Debanjum Singh Solanky 2024-04-25 15:19:59 +05:30
parent 17a06f152c
commit 1842017393

View file

@ -170,11 +170,21 @@ function pushDataToKhoj (regenerate = false) {
// Collect paths of all configured files to index
for (const file of files) {
// Remove files that no longer exist
if (!fs.existsSync(file.path)) {
console.error(`${file.path} does not exist`);
continue;
}
filesToPush.push(file.path);
}
// Collect paths of all indexable files in configured folders
for (const folder of folders) {
// Remove folders that no longer exist
if (!fs.existsSync(folder.path)) {
console.error(`${folder.path} does not exist`);
continue;
}
processDirectory(filesToPush, folder);
}