test: simplify install package dir scans · openclaw/openclaw@b07b21d
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -16,14 +16,24 @@ vi.mock("../process/exec.js", async () => {
|
16 | 16 | |
17 | 17 | async function listMatchingDirs(root: string, prefix: string): Promise<string[]> { |
18 | 18 | const entries = await fs.readdir(root, { withFileTypes: true }); |
19 | | -return entries |
20 | | -.filter((entry) => entry.isDirectory() && entry.name.startsWith(prefix)) |
21 | | -.map((entry) => entry.name); |
| 19 | +const names: string[] = []; |
| 20 | +for (const entry of entries) { |
| 21 | +if (entry.isDirectory() && entry.name.startsWith(prefix)) { |
| 22 | +names.push(entry.name); |
| 23 | +} |
| 24 | +} |
| 25 | +return names; |
22 | 26 | } |
23 | 27 | |
24 | 28 | async function listMatchingEntries(root: string, prefix: string): Promise<string[]> { |
25 | 29 | const entries = await fs.readdir(root, { withFileTypes: true }); |
26 | | -return entries.filter((entry) => entry.name.startsWith(prefix)).map((entry) => entry.name); |
| 30 | +const names: string[] = []; |
| 31 | +for (const entry of entries) { |
| 32 | +if (entry.name.startsWith(prefix)) { |
| 33 | +names.push(entry.name); |
| 34 | +} |
| 35 | +} |
| 36 | +return names; |
27 | 37 | } |
28 | 38 | |
29 | 39 | function normalizeDarwinTmpPath(filePath: string): string { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。