-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry.cpp
More file actions
26 lines (18 loc) · 819 Bytes
/
entry.cpp
File metadata and controls
26 lines (18 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <kapalaframe-logger/logger.h>
#include <kapalaframe-sys/entry.h>
#include <kapalaframe-sys/file.h>
#include "loader.h"
Async::Task<> entryPointAsync(Sys::Context& ctx) {
logInfo("shoolLoader " stringify$(__ck_version_value));
logInfo("loading configs...");
auto file = co_try$(Sys::File::open("file:/boot/loader.json"_url));
logInfo("parsing configs...");
auto fileStr = co_try$(Io::readAllUtf8(file));
auto json = co_try$(Json::parse(fileStr));
logInfo("validating configs...");
logInfo("configs: {}", json);
auto configs = co_try$(ShoolLoader::Configs::fromJson(json));
if (configs.entries.len() > 1 or configs.entries.len() == 0)
co_return co_await ShoolLoader::showMenuAsync(ctx, configs);
co_return ShoolLoader::loadEntry(configs.entries[0]);
}