Skip to content

Commit

Permalink
Skip trying to index deleted files, folders from Desktop app
Browse files Browse the repository at this point in the history
Previously app would crash on startup if desktop app was told to
index a file that had been deleted afterwards
  • Loading branch information
debanjum committed Apr 25, 2024
1 parent 17a06f1 commit 1842017
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/interface/desktop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 1842017

Please sign in to comment.