Merge develop into main (#343)
- Refactor `AppManifest`: add new fields and rename existing ones - Parse and validate the manifest from an app that is being installed. - Remove deprecated `scoped()` from `Lock` - Create `Tactility/Paths.h` - App loading at boot now properly parses the manifest files of external apps - Properly lock both source and destination locations during app install - Remove LVGL path variants from `AppPaths` and `ServicePaths` - Removed `xPath` base classes for apps and services. There's now `AppPaths` and `ServicePaths`. - Renamed app and service paths: "data" and "system" paths are now "user data" and "assets"
This commit is contained in:
committed by
GitHub
parent
a4d15b2a1e
commit
bab3eb19bc
@@ -1,3 +1,5 @@
|
||||
#include "Tactility/app/AppManifestParsing.h"
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/TactilityConfig.h>
|
||||
#include <Tactility/app/AppRegistration.h>
|
||||
@@ -158,29 +160,22 @@ static void registerInstalledApp(std::string path) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> manifest;
|
||||
if (!file::loadPropertiesFile(manifest_path, manifest)) {
|
||||
std::map<std::string, std::string> properties;
|
||||
if (!file::loadPropertiesFile(manifest_path, properties)) {
|
||||
TT_LOG_E(TAG, "Failed to load manifest at %s", manifest_path.c_str());
|
||||
}
|
||||
|
||||
auto app_id_entry = manifest.find("[app]id");
|
||||
if (app_id_entry == manifest.end()) {
|
||||
TT_LOG_E(TAG, "Failed to find app id in manifest");
|
||||
return;
|
||||
}
|
||||
|
||||
auto app_name_entry = manifest.find("[app]name");
|
||||
if (app_name_entry == manifest.end()) {
|
||||
TT_LOG_E(TAG, "Failed to find app name in manifest");
|
||||
app::AppManifest manifest;
|
||||
if (!app::parseManifest(properties, manifest)) {
|
||||
TT_LOG_E(TAG, "Failed to parse manifest at %s", manifest_path.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
app::addApp({
|
||||
.id = app_id_entry->second,
|
||||
.name = app_name_entry->second,
|
||||
.category = app::Category::User,
|
||||
.location = app::Location::external(path)
|
||||
});
|
||||
manifest.appCategory = app::Category::User;
|
||||
manifest.appLocation = app::Location::external(path);
|
||||
|
||||
app::addApp(manifest);
|
||||
}
|
||||
|
||||
static void registerInstalledApps(const std::string& path) {
|
||||
@@ -194,7 +189,7 @@ static void registerInstalledApps(const std::string& path) {
|
||||
|
||||
static void registerInstalledAppsFromSdCard(const std::shared_ptr<hal::sdcard::SdCardDevice>& sdcard) {
|
||||
auto sdcard_root_path = sdcard->getMountPath();
|
||||
auto app_path = std::format("{}/apps", sdcard_root_path);
|
||||
auto app_path = std::format("{}/app", sdcard_root_path);
|
||||
sdcard->getLock()->lock();
|
||||
if (file::isDirectory(app_path)) {
|
||||
registerInstalledApps(app_path);
|
||||
@@ -289,7 +284,7 @@ void run(const Configuration& config) {
|
||||
TT_LOG_I(TAG, "Starting boot app");
|
||||
// The boot app takes care of registering system apps, user services and user apps
|
||||
addApp(app::boot::manifest);
|
||||
service::loader::startApp(app::boot::manifest.id);
|
||||
service::loader::startApp(app::boot::manifest.appId);
|
||||
|
||||
TT_LOG_I(TAG, "Main dispatcher ready");
|
||||
while (true) {
|
||||
|
||||
Reference in New Issue
Block a user