This commit is contained in:
Michael Zhang 2024-07-25 05:06:31 -05:00
parent bf18eb4168
commit 94c3ca8773

View file

@ -22,9 +22,16 @@ export async function loadApps(): Promise<Map<string, CustomApp>> {
"/Users/michael/Projects/panorama/apps", "/Users/michael/Projects/panorama/apps",
]; ];
for (const basePath of paths) { async function getChildren(dir: string): Promise<string[]> {
try { try {
const children = await readdir(basePath); return await readdir(dir);
} catch (e) {
return [];
}
}
for (const basePath of paths) {
const children = await getChildren(basePath);
for (const name of children) { for (const name of children) {
const child = join(basePath, name); const child = join(basePath, name);
try { try {
@ -32,17 +39,6 @@ export async function loadApps(): Promise<Map<string, CustomApp>> {
apps.set(app.name, app); apps.set(app.name, app);
} catch (e) { } catch (e) {
console.error("Error setting up " + child + ": " + e.message) console.error("Error setting up " + child + ": " + e.message)
throw e;
}
}
} catch (e) {
if (e.name === "ResolveMessage") {
console.warn("Path " + basePath + " not found")
}
else {
console.error("Error: " + e.message);
console.error(e.stackTrace)
throw e;
} }
} }
} }