From 8da55b3c92e0a21bbc4b2524e13b09818f47a56f Mon Sep 17 00:00:00 2001 From: Danil Ovchinnikov Date: Sat, 15 Nov 2025 03:16:58 +0300 Subject: [PATCH] feat(indexing): check that stdlib can be read --- server/src/indexing/indexing.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/src/indexing/indexing.ts b/server/src/indexing/indexing.ts index 89461763..ff6679d5 100644 --- a/server/src/indexing/indexing.ts +++ b/server/src/indexing/indexing.ts @@ -2,6 +2,8 @@ import {fileURLToPath} from "node:url" import * as path from "node:path" +import * as fs from "node:fs" + import {glob} from "glob" import {filePathToUri} from "@server/files" @@ -40,6 +42,10 @@ export abstract class IndexingRoot { ignore: ignore, }) if (files.length === 0) { + if (!this.checkReadAccess(this.root)) { + console.warn(`Can't access ${this.root}`) + } + console.warn(`No file to index in ${this.root}`) } for (const filePath of files) { @@ -50,5 +56,14 @@ export abstract class IndexingRoot { } } + private checkReadAccess(path: string): boolean { + try { + fs.accessSync(path, fs.constants.R_OK) + return true + } catch { + return false + } + } + protected abstract onFile(uri: string): Promise }