mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 21:29:12 +00:00
Skip indexing non-existent folders on Desktop app
This commit is contained in:
@@ -121,6 +121,7 @@ function isSupportedFileType(filePath) {
|
||||
}
|
||||
|
||||
function processDirectory(filesToPush, folder) {
|
||||
try {
|
||||
const files = fs.readdirSync(folder.path, { withFileTypes: true });
|
||||
|
||||
for (const file of files) {
|
||||
@@ -139,6 +140,17 @@ function processDirectory(filesToPush, folder) {
|
||||
processDirectory(filesToPush, {'path': filePath});
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if (err.code === 'EACCES') {
|
||||
console.error(`Access denied to ${folder.path}`);
|
||||
} else if (err.code === 'ENOENT') {
|
||||
console.error(`${folder.path} does not exist`);
|
||||
} else {
|
||||
console.error(`An error occurred while reading directory: ${error.message}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pushDataToKhoj (regenerate = false) {
|
||||
|
||||
Reference in New Issue
Block a user