From 94c3ca8773ca3a38e52fb69a712eaf5ab71d48d4 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Thu, 25 Jul 2024 05:06:31 -0500 Subject: [PATCH] update --- packages/panorama-daemon/src/apps/index.ts | 34 ++++++++++------------ 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/packages/panorama-daemon/src/apps/index.ts b/packages/panorama-daemon/src/apps/index.ts index 52aacb5..0f65d16 100644 --- a/packages/panorama-daemon/src/apps/index.ts +++ b/packages/panorama-daemon/src/apps/index.ts @@ -22,27 +22,23 @@ export async function loadApps(): Promise> { "/Users/michael/Projects/panorama/apps", ]; - for (const basePath of paths) { + async function getChildren(dir: string): Promise { try { - const children = await readdir(basePath); - for (const name of children) { - const child = join(basePath, name); - try { - const app = await loadApp(child); - apps.set(app.name, app); - } catch (e) { - console.error("Error setting up " + child + ": " + e.message) - throw e; - } - } + return await readdir(dir); } catch (e) { - if (e.name === "ResolveMessage") { - console.warn("Path " + basePath + " not found") - } - else { - console.error("Error: " + e.message); - console.error(e.stackTrace) - throw e; + return []; + } + } + + for (const basePath of paths) { + const children = await getChildren(basePath); + for (const name of children) { + const child = join(basePath, name); + try { + const app = await loadApp(child); + apps.set(app.name, app); + } catch (e) { + console.error("Error setting up " + child + ": " + e.message) } } }