Skip to content

Commit 4656a57

Browse files
committed
example possible error fix
1 parent ebeb2c5 commit 4656a57

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/node-addon-examples/scripts/cmake-projects.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { readdirSync, statSync } from "node:fs";
1+
import { readdirSync, statSync, existsSync } from "node:fs";
22
import path from "node:path";
33

44
export const EXAMPLES_DIR = path.resolve(import.meta.dirname, "../examples");
@@ -7,6 +7,9 @@ export const DIRS = [EXAMPLES_DIR, TESTS_DIR];
77

88
export function findCMakeProjectsRecursively(dir: string): string[] {
99
let results: string[] = [];
10+
if (!existsSync(dir)) {
11+
return results;
12+
}
1013
const files = readdirSync(dir);
1114

1215
for (const file of files) {

0 commit comments

Comments
 (0)