Ken Van Hoeylandt f8172446fd
App loading improvements and more (#675)
- External apps can opt into automatic cleanup when they exit, including tracked tasks, threads, files, directories, and memory.
- App-relative file paths resolve against the app’s working directory, with `.` and `..` normalized.
- The shell identifies ELF binaries that cannot be executed instead of treating them as scripts.
- Shared icon fonts now offer distinct default and large sizes, with updated icons across the interface.
- ESP32 apps can load additional ELF formats when address mirroring is enabled.
- Terminal colors render clearly on monochrome displays, and toolbar buttons have cleaner styling.
- GPS settings safely refresh their device list when their window is hidden or its widgets are destroyed.
2026-10-06 07:45:58 +02:00

38 lines
796 B
C++

// SPDX-License-Identifier: Apache-2.0
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
namespace {
struct FileHolder {
FILE* file = nullptr;
~FileHolder() {
if (file != nullptr) {
fclose(file);
}
}
};
// Destroyed when the binary is unloaded, after the app ended
std::vector<char> buffer;
FileHolder holder;
} // namespace
// Fills static objects with memory and a file their destructors release. Ends with exit() when argv[1] is "exit".
extern "C" int32_t main(int argc, char* argv[]) {
buffer.resize(4096);
holder.file = fopen("/dev/null", "r");
if (holder.file == nullptr) {
return 1;
}
if (argc > 1 && strcmp(argv[1], "exit") == 0) {
exit(0);
}
return 0;
}