mirror of
https://github.com/github/codeql-action.git
synced 2026-01-01 20:20:07 +08:00
Refactoring per PR comments
This commit is contained in:
16
src/util.ts
16
src/util.ts
@@ -768,3 +768,19 @@ export function doesDirectoryExist(dirPath: string): boolean {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of files in a given directory.
|
||||
*/
|
||||
export function listFolder(dir: string): string[] {
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||
let files: string[] = [];
|
||||
for (const entry of entries) {
|
||||
if (entry.isFile()) {
|
||||
files.push(path.resolve(dir, entry.name));
|
||||
} else if (entry.isDirectory()) {
|
||||
files = files.concat(listFolder(path.resolve(dir, entry.name)));
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user