Ken Van Hoeylandt 79d3dd4fdb
Improvements for apps, filesystems, terminal and shell (#659)
app-module

- Apps now have support for:
  - environment variables (inherit from parent app)
  - current workdir
  - window size (when running in terminal)
- Add type aliases like `AppId` and `PackageId`
- Remove data duplication between ledger and app instance records: create `AppManifestSet`
- `AppManifest` usage safety improved: pass by value where needed, or use `AppId` instead of a manifest.

Terminal and shell

- Moved shell commands into coreutils-module as proper apps.
- Refine stack size for terminal and shell because apps now run with their own task and stack (including in-memory apps)

Platform

- Fix for listing root dir on ESP32: wrap posix directory functions and wire in file systems.
- Moved all platform-specific file system init code to platform subprojects

Other

- Fix for screenshot capture (issue with paths)
- Fixes for coreutils app correctness
- Memory optimizations (use more PSRAM where possible) in various locations such as app-module, shell and terminal.
- `ls` and `help` commands now use terminal width and show columns of data by default
- Created fs helpers at `TactilityKernel/include/tactility/filesystem/fs.h` (partially ported from `ShellFs`)
2026-09-25 08:29:27 +02:00

33 lines
1.2 KiB
C++

// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <app/manifest.h>
#include <app/package_manifest.h>
#include <app/private/binary_path.h>
#include <TactilityCpp/Allocator.h>
#include <string>
#include <vector>
/**
* Owns AppManifest copies (and their backing location-path strings) that app_manager's ledger
* only holds non-owning pointers to. Built once and never resized:
* AppManifest::location.location points into `locations`, which a reallocation would dangle.
* OptExternalAllocator since this is off the app start/stop hot path, so PSRAM is fine.
*/
struct AppManifestSet {
std::vector<AppManifest, tt::OptExternalAllocator<AppManifest>> manifests;
std::vector<std::string, tt::OptExternalAllocator<std::string>> locations;
AppManifestSet(const std::string& install_dir, const AppManifestBinding* bindings, size_t count) {
manifests.resize(count);
locations.resize(count);
for (size_t i = 0; i < count; i++) {
manifests[i] = bindings[i].manifest;
locations[i] = app_resolve_binary_path(install_dir, bindings[i].binary);
manifests[i].location = { APP_LOCATION_PATH, const_cast<char*>(locations[i].c_str()) };
}
}
};