(logger: Logger, parent: string, options?: { allowBin?: boolean; allowCache?: boolean })
| 130 | } |
| 131 | |
| 132 | export async function getChildFolders(logger: Logger, parent: string, options?: { allowBin?: boolean; allowCache?: boolean }): Promise<string[]> { |
| 133 | if (!fs.existsSync(parent)) |
| 134 | return []; |
| 135 | const files = await readDirAsync(logger, parent); |
| 136 | |
| 137 | return files.filter((f) => f.isDirectory()) |
| 138 | .filter((f) => f.name !== "bin" || (options?.allowBin)) // Don't look in bin folders |
| 139 | .filter((f) => f.name !== "cache" || (options?.allowCache)) // Don't look in cache folders |
| 140 | .map((item) => path.join(parent, item.name)); |
| 141 | } |
| 142 | |
| 143 | function readDirAsync(logger: Logger, folder: string): Promise<fs.Dirent[]> { |
| 144 | return new Promise<fs.Dirent[]>((resolve) => fs.readdir(folder, |
no test coverage detected