Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#endif
|
||||
|
||||
#include <format>
|
||||
#include <map>
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/TactilityConfig.h>
|
||||
@@ -17,7 +16,6 @@
|
||||
#include <Tactility/app/AppRegistration.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/file/FileLock.h>
|
||||
#include <Tactility/file/PropertiesFile.h>
|
||||
#include <Tactility/hal/HalPrivate.h>
|
||||
#include <Tactility/lvgl/LvglPrivate.h>
|
||||
#include <Tactility/network/NtpPrivate.h>
|
||||
@@ -37,6 +35,9 @@
|
||||
#include <Tactility/InitEsp.h>
|
||||
#endif
|
||||
|
||||
#include "Tactility/Paths.h"
|
||||
|
||||
|
||||
#include <Tactility/bluetooth/Bluetooth.h>
|
||||
|
||||
namespace tt {
|
||||
@@ -103,6 +104,7 @@ namespace app {
|
||||
namespace power { extern const AppManifest manifest; }
|
||||
namespace selectiondialog { extern const AppManifest manifest; }
|
||||
namespace settings { extern const AppManifest manifest; }
|
||||
namespace setup { extern const AppManifest manifest; }
|
||||
namespace systeminfo { extern const AppManifest manifest; }
|
||||
namespace timedatesettings { extern const AppManifest manifest; }
|
||||
namespace touchcalibration { extern const AppManifest manifest; }
|
||||
@@ -157,6 +159,7 @@ static void registerInternalApps() {
|
||||
addAppManifest(app::notes::manifest);
|
||||
addAppManifest(app::settings::manifest);
|
||||
addAppManifest(app::selectiondialog::manifest);
|
||||
addAppManifest(app::setup::manifest);
|
||||
addAppManifest(app::systeminfo::manifest);
|
||||
addAppManifest(app::timedatesettings::manifest);
|
||||
addAppManifest(app::touchcalibration::manifest);
|
||||
@@ -216,14 +219,8 @@ static void registerInstalledApp(std::string path) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> properties;
|
||||
if (!file::loadPropertiesFile(manifest_path, properties)) {
|
||||
LOGGER.error("Failed to load manifest at {}", manifest_path);
|
||||
return;
|
||||
}
|
||||
|
||||
app::AppManifest manifest;
|
||||
if (!app::parseManifest(properties, manifest)) {
|
||||
if (!app::parseManifest(manifest_path, manifest)) {
|
||||
LOGGER.error("Failed to parse manifest at {}", manifest_path);
|
||||
return;
|
||||
}
|
||||
@@ -250,7 +247,7 @@ static void registerInstalledAppsFromFileSystems() {
|
||||
if (!file_system_is_mounted(fs)) return true;
|
||||
char path[128];
|
||||
if (file_system_get_path(fs, path, sizeof(path)) != ERROR_NONE) return true;
|
||||
const auto app_path = std::format("{}/app", path);
|
||||
const auto app_path = std::format("{}/tactility/app", path);
|
||||
if (!app_path.starts_with(file::MOUNT_POINT_SYSTEM) && file::isDirectory(app_path)) {
|
||||
LOGGER.info("Registering apps from {}", app_path);
|
||||
registerInstalledApps(app_path);
|
||||
@@ -292,18 +289,21 @@ static void registerAndStartPrimaryServices() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void createTempDirectory(const std::string& rootPath) {
|
||||
auto temp_path = std::format("{}/tmp", rootPath);
|
||||
void createTempDirectory() {
|
||||
auto data_path = getUserDataPath();
|
||||
auto temp_path = std::format("{}/tmp", data_path);
|
||||
if (!file::isDirectory(temp_path)) {
|
||||
auto lock = file::getLock(rootPath)->asScopedLock();
|
||||
auto lock = file::getLock(data_path)->asScopedLock();
|
||||
if (lock.lock(1000 / portTICK_PERIOD_MS)) {
|
||||
if (mkdir(temp_path.c_str(), 0777) == 0) {
|
||||
if (!file::findOrCreateParentDirectory(temp_path, 0777)) {
|
||||
LOGGER.error("Failed to create {}", data_path);
|
||||
} else if (mkdir(temp_path.c_str(), 0777) == 0) {
|
||||
LOGGER.info("Created {}", temp_path);
|
||||
} else {
|
||||
LOGGER.error("Failed to create {}", temp_path);
|
||||
}
|
||||
} else {
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, rootPath);
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, data_path);
|
||||
}
|
||||
} else {
|
||||
LOGGER.info("Found existing {}", temp_path);
|
||||
@@ -311,14 +311,7 @@ void createTempDirectory(const std::string& rootPath) {
|
||||
}
|
||||
|
||||
void prepareFileSystems() {
|
||||
file_system_for_each(nullptr, [](auto* fs, void* context) {
|
||||
if (!file_system_is_mounted(fs)) return true;
|
||||
char path[128];
|
||||
if (file_system_get_path(fs, path, sizeof(path)) != ERROR_NONE) return true;
|
||||
if (std::string(path) == file::MOUNT_POINT_SYSTEM) return true;
|
||||
createTempDirectory(path);
|
||||
return true;
|
||||
});
|
||||
createTempDirectory();
|
||||
}
|
||||
|
||||
void registerApps() {
|
||||
|
||||
Reference in New Issue
Block a user