Files
tactility/Tactility/Source/DeprecatedPaths.cpp
T
Ken Van Hoeylandt 643cbc3806 Implement posix app loading (#643)
- Added POSIX desktop support for SDK builds, application packaging, and integration testing.
- Added POSIX filesystem partitions and improved application path handling.
- Added simulator support for loading and running applications dynamically.
- Improved simulator task stack handling and display startup reliability.
- Improved simulator display scaling, resizing, high-DPI support, and pointer accuracy.
- Fixed LVGL timers and input polling on POSIX. (fixes simulator with Linux on some Intel graphics platforms)
- Standardized data paths across platforms.
- Logging now works via separate task: this allows apps to write to log without it affecting their stdout (for apps that output text as relevant date for other apps, like the File Selection app)
- Fixes for app stdio
2026-08-31 22:09:04 +02:00

80 lines
2.1 KiB
C++

#include <Tactility/DeprecatedPaths.h>
#include <app/manifest.h>
#include <Tactility/MountPoints.h>
#include <format>
#include <tactility/check.h>
#include <tactility/device.h>
#include <tactility/drivers/sdcard.h>
#include <tactility/filesystem/file_system.h>
namespace tt {
bool findFirstMountedSdCardPath(std::string& path) {
auto* fs = findSdcardFileSystem(true);
if (fs == nullptr) return false;
char found_path[128];
if (file_system_get_path(fs, found_path, sizeof(found_path)) != ERROR_NONE) return false;
path = found_path;
return true;
}
FileSystem* findSdcardFileSystem(bool mustBeMounted) {
FileSystem* found = nullptr;
file_system_for_each(&found, [](auto* fs, void* context) {
auto* owner = file_system_get_owner(fs);
if (owner == nullptr || device_get_type(owner) != &SDCARD_TYPE) {
return true;
}
*static_cast<FileSystem**>(context) = fs;
return false;
});
if (found && mustBeMounted && !file_system_is_mounted(found)) {
return nullptr;
}
return found;
}
std::string getUserDataRootPath() {
#ifdef CONFIG_TT_USER_DATA_LOCATION_INTERNAL
return file::MOUNT_POINT_DATA;
#elif CONFIG_TT_USER_DATA_LOCATION_SD
auto* fs = findSdcardFileSystem(false);
check(fs);
char fs_path[32];
check(file_system_get_path(fs, fs_path, sizeof(fs_path)) == ERROR_NONE);
return std::string(fs_path);
#else
#error CONFIG_TT_USER_DATA_* not set or unsupported
#endif
}
std::string getDataPath() {
return getUserDataRootPath() + "/tactility";
}
std::string getTempPath() {
return getDataPath() + "/tmp";
}
std::string getAppInstallPath() {
return getDataPath() + "/app";
}
std::string getUserHomePath() {
return getDataPath() + "/user";
}
std::string getAppInstallPath(const std::string& appId) {
assert(app_id_is_valid(appId.c_str()));
return std::format("{}/{}", getAppInstallPath(), appId);
}
std::string getAppUserPath(const std::string& appId) {
assert(app_id_is_valid(appId.c_str()));
return std::format("{}/app/{}", getUserHomePath(), appId);
}
}