update
This commit is contained in:
parent
bf18eb4168
commit
94c3ca8773
1 changed files with 15 additions and 19 deletions
|
@ -22,27 +22,23 @@ 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);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.name === "ResolveMessage") {
|
return [];
|
||||||
console.warn("Path " + basePath + " not found")
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
console.error("Error: " + e.message);
|
for (const basePath of paths) {
|
||||||
console.error(e.stackTrace)
|
const children = await getChildren(basePath);
|
||||||
throw e;
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue