mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-12-03 12:23:02 +01:00
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:
parent
17a06f152c
commit
1842017393
1 changed files with 10 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue