Răsfoiți Sursa

core: prevent file system scanning when in root directory to avoid unnecessary operations

Dax Raad 4 luni în urmă
părinte
comite
71af1859fa
1 a modificat fișierele cu 2 adăugiri și 0 ștergeri
  1. 2 0
      packages/opencode/src/file/index.ts

+ 2 - 0
packages/opencode/src/file/index.ts

@@ -125,6 +125,8 @@ export namespace File {
     let cache: Entry = { files: [], dirs: [] }
     let fetching = false
     const fn = async (result: Entry) => {
+      // Disable scanning if in root of file system
+      if (Instance.directory === path.parse(Instance.directory).root) return
       fetching = true
       const set = new Set<string>()
       for await (const file of Ripgrep.files({ cwd: Instance.directory })) {