From ef4d0c6cdccdef72381ae73bda30975e591210f0 Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Wed, 19 Aug 2026 21:55:34 +0200 Subject: [PATCH] Fixes for paths --- Modules/app-module/source/app_install.cpp | 2 +- Modules/app-module/source/app_paths.cpp | 2 +- Modules/service-module/source/paths.cpp | 2 +- Tactility/Source/app/i2cscanner/I2cScanner.cpp | 9 +++++---- Tactility/Source/app/setup/Setup.cpp | 4 ++-- Tactility/Source/network/Ntp.cpp | 8 +++++--- Tactility/Source/settings/time.cpp | 6 ++++-- TactilityKernel/include/tactility/paths.h | 2 +- TactilityKernel/source/paths.cpp | 6 +++--- TactilityKernel/source/symbols.c | 2 +- 10 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Modules/app-module/source/app_install.cpp b/Modules/app-module/source/app_install.cpp index 8d7820099..d9dfe213f 100644 --- a/Modules/app-module/source/app_install.cpp +++ b/Modules/app-module/source/app_install.cpp @@ -72,7 +72,7 @@ bool delete_recursively(const std::string& path) { bool get_app_install_directory(std::string& out_path) { char root[192]; - if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) { + if (paths_get_data_path(root, sizeof(root)) != ERROR_NONE) { return false; } out_path = std::string(root) + "/app"; diff --git a/Modules/app-module/source/app_paths.cpp b/Modules/app-module/source/app_paths.cpp index 8d4e1a9a1..da7f0a4ec 100644 --- a/Modules/app-module/source/app_paths.cpp +++ b/Modules/app-module/source/app_paths.cpp @@ -11,7 +11,7 @@ extern "C" { error_t app_paths_get_user_data_directory(const char* app_id, char* out_path, size_t out_path_size) { char root[192]; - error_t error = paths_get_user_data_path(root, sizeof(root)); + error_t error = paths_get_data_path(root, sizeof(root)); if (error != ERROR_NONE) { return error; } diff --git a/Modules/service-module/source/paths.cpp b/Modules/service-module/source/paths.cpp index 558af2654..8dad5562f 100644 --- a/Modules/service-module/source/paths.cpp +++ b/Modules/service-module/source/paths.cpp @@ -9,7 +9,7 @@ extern "C" { error_t service_paths_get_user_data_directory(const char* service_id, char* out_path, size_t out_path_size) { char root[192]; - error_t error = paths_get_user_data_path(root, sizeof(root)); + error_t error = paths_get_data_path(root, sizeof(root)); if (error != ERROR_NONE) { return error; } diff --git a/Tactility/Source/app/i2cscanner/I2cScanner.cpp b/Tactility/Source/app/i2cscanner/I2cScanner.cpp index 1ab9b84d9..c79a84b9f 100644 --- a/Tactility/Source/app/i2cscanner/I2cScanner.cpp +++ b/Tactility/Source/app/i2cscanner/I2cScanner.cpp @@ -1,18 +1,19 @@ -#include -#include + #include #include #include +#include +#include #include #include #include +#include #include #include #include -#include #include #include @@ -55,7 +56,7 @@ struct Context { bool getPreferencesPath(std::string& outPath) { char root[128]; - if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) { + if (app_paths_get_user_data_directory(manifest.id, root, sizeof(root)) != ERROR_NONE) { return false; } outPath = std::string(root) + "/i2c_scanner.properties"; diff --git a/Tactility/Source/app/setup/Setup.cpp b/Tactility/Source/app/setup/Setup.cpp index 9bbf7c858..afa501b55 100644 --- a/Tactility/Source/app/setup/Setup.cpp +++ b/Tactility/Source/app/setup/Setup.cpp @@ -9,11 +9,11 @@ #include #include #include +#include #include #include -#include #include #include @@ -40,7 +40,7 @@ namespace { bool getCompletedMarkerPath(std::string& outPath) { char root[128]; - if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) { + if (app_paths_get_user_data_directory(manifest.id, root, sizeof(root)) != ERROR_NONE) { return false; } outPath = std::string(root) + "/.setup_complete"; diff --git a/Tactility/Source/network/Ntp.cpp b/Tactility/Source/network/Ntp.cpp index c1d513366..e1ab0dae3 100644 --- a/Tactility/Source/network/Ntp.cpp +++ b/Tactility/Source/network/Ntp.cpp @@ -1,14 +1,15 @@ +#include + #include #include #include #include +#include #include #ifdef ESP_PLATFORM -#include -#include #include #include #endif @@ -23,7 +24,8 @@ static bool processedSyncEvent = false; static bool getPreferencesPath(std::string& outPath) { char root[128]; - if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) { + // Not really a service, but this is the best way of organising it for now + if (service_paths_get_user_data_directory("tactility.ntp", root, sizeof(root)) != ERROR_NONE) { return false; } outPath = std::string(root) + "/time.properties"; diff --git a/Tactility/Source/settings/time.cpp b/Tactility/Source/settings/time.cpp index 79f027923..9c6e19518 100644 --- a/Tactility/Source/settings/time.cpp +++ b/Tactility/Source/settings/time.cpp @@ -1,5 +1,6 @@ -#include +#include +#include #include #include @@ -24,7 +25,8 @@ namespace { // "syncTime" - matches the shared NVS namespace this used to be. bool getPreferencesPath(std::string& outPath) { char root[128]; - if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) { + // Not really a service, but this is the best way of organising it for now + if (service_paths_get_user_data_directory("tactility.time", root, sizeof(root)) != ERROR_NONE) { return false; } outPath = std::string(root) + "/" + TIME_SETTINGS_NAMESPACE + ".properties"; diff --git a/TactilityKernel/include/tactility/paths.h b/TactilityKernel/include/tactility/paths.h index e8277c283..f4820150a 100644 --- a/TactilityKernel/include/tactility/paths.h +++ b/TactilityKernel/include/tactility/paths.h @@ -17,7 +17,7 @@ extern "C" { * @retval ERROR_BUFFER_OVERFLOW if out_path_size is too small * @retval ERROR_NONE on success */ -error_t paths_get_user_data_path(char* out_path, size_t out_path_size); +error_t paths_get_data_path(char* out_path, size_t out_path_size); #ifdef __cplusplus } diff --git a/TactilityKernel/source/paths.cpp b/TactilityKernel/source/paths.cpp index 85bc2f522..3319c6304 100644 --- a/TactilityKernel/source/paths.cpp +++ b/TactilityKernel/source/paths.cpp @@ -8,7 +8,7 @@ #include #include -static error_t paths_get_user_data_root_path(char* out_path, size_t out_path_size) { +static error_t paths_get_data_root_path(char* out_path, size_t out_path_size) { #if defined(CONFIG_TT_USER_DATA_LOCATION_INTERNAL) #ifdef ESP_PLATFORM const char* mount_point = "/data"; @@ -41,10 +41,10 @@ static error_t paths_get_user_data_root_path(char* out_path, size_t out_path_siz extern "C" { -error_t paths_get_user_data_path(char* out_path, size_t out_path_size) { +error_t paths_get_data_path(char* out_path, size_t out_path_size) { #ifdef ESP_PLATFORM char root[64]; - error_t error = paths_get_user_data_root_path(root, sizeof(root)); + error_t error = paths_get_data_root_path(root, sizeof(root)); if (error != ERROR_NONE) { return error; } diff --git a/TactilityKernel/source/symbols.c b/TactilityKernel/source/symbols.c index 4f3956d4e..0f1d93030 100644 --- a/TactilityKernel/source/symbols.c +++ b/TactilityKernel/source/symbols.c @@ -249,7 +249,7 @@ const struct ModuleSymbol KERNEL_SYMBOLS[] = { DEFINE_MODULE_SYMBOL(keyboard_read_key), DEFINE_MODULE_SYMBOL(KEYBOARD_TYPE), // drivers/paths - DEFINE_MODULE_SYMBOL(paths_get_user_data_path), + DEFINE_MODULE_SYMBOL(paths_get_data_path), // drivers/pointer DEFINE_MODULE_SYMBOL(pointer_enter_sleep), DEFINE_MODULE_SYMBOL(pointer_exit_sleep),