From 109ac88bab0f1e9e85889df273f57878987976e6 Mon Sep 17 00:00:00 2001 From: Alvin Dimas Praditya Date: Sun, 20 Oct 2024 19:50:06 +0700 Subject: [PATCH] fix: error when file is missing --- src/commandline.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/commandline.ts b/src/commandline.ts index 7f980fc..f82445e 100644 --- a/src/commandline.ts +++ b/src/commandline.ts @@ -145,16 +145,18 @@ export default class CommandLine { const files = fs.readdirSync(dir); for (const file of files) { - const filePath = path.join(dir, file); - const stats = fs.statSync(filePath); - - if (stats.isDirectory() && !filePath.endsWith('.app')) { - this.getApps(filePath); - } else if (filePath.endsWith('.app')) { - const app = new App(filePath); - if(!app.supported()) continue; - this.supportedApps.push(new App(filePath)); - } + try { + const filePath = path.join(dir, file); + const stats = fs.statSync(filePath); + + if (stats.isDirectory() && !filePath.endsWith('.app')) { + this.getApps(filePath); + } else if (filePath.endsWith('.app')) { + const app = new App(filePath); + if(!app.supported()) continue; + this.supportedApps.push(new App(filePath)); + } + } catch {} } } } \ No newline at end of file