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

44 lines
1.5 KiB
C

// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <stddef.h>
#include <tactility/error.h>
/**
* Per-app-instance current working directory, scoped to the calling app instance. Inherited from
* the parent instance at start (like app/env.h's environment), defaulting to "/" for a top-level
* instance, and mutable at runtime via app_dir_set_cwd(). Every function here acts on
* app_scheduler_current_app_id()'s own instance; there is no way to read or change another
* instance's cwd.
*
* Matches POSIX getcwd()/chdir() semantics, and is what their real-syscall wraps
* (Modules/app-module/source/stdio_wrap.cpp) route to for a calling task that is an app instance.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @param[in,out] size capacity of @a buf on input; unchanged on output
* @retval ERROR_NOT_FOUND the calling task isn't a running app instance
* @retval ERROR_BUFFER_OVERFLOW @a buf is too small
* @retval ERROR_NONE on success
*/
error_t app_dir_get_cwd(char* buf, size_t size);
/**
* @param[in] absolute_path must be "/" or an existing directory; not resolved or normalized -
* the caller resolves relative segments against app_dir_get_cwd() itself first.
* @retval ERROR_NOT_FOUND the calling task isn't a running app instance, or @a absolute_path
* doesn't exist
* @retval ERROR_INVALID_ARGUMENT @a absolute_path is NULL or not absolute
* @retval ERROR_NONE on success
*/
error_t app_dir_set_cwd(const char* absolute_path);
#ifdef __cplusplus
}
#endif