MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / getChildFolders

Function getChildFolders

src/shared/utils/fs.ts:132–141  ·  view source on GitHub ↗
(logger: Logger, parent: string, options?: { allowBin?: boolean; allowCache?: boolean })

Source from the content-addressed store, hash-verified

130}
131
132export 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
143function readDirAsync(logger: Logger, folder: string): Promise<fs.Dirent[]> {
144 return new Promise<fs.Dirent[]>((resolve) => fs.readdir(folder,

Callers 3

promptForSdkFunction · 0.90
findProjectFoldersFunction · 0.85

Calls 1

readDirAsyncFunction · 0.85

Tested by

no test coverage detected