643cbc3806
- 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
43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
#include "Tactility/MountPoints.h"
|
|
|
|
#include "Tactility/TactilityConfig.h"
|
|
|
|
#include <Tactility/file/File.h>
|
|
|
|
#include <cstring>
|
|
#include <dirent.h>
|
|
#include <tactility/filesystem/file_system.h>
|
|
#include <vector>
|
|
|
|
namespace tt::file {
|
|
|
|
std::vector<dirent> getFileSystemDirents() {
|
|
std::vector<dirent> dir_entries;
|
|
|
|
file_system_for_each(&dir_entries, [](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;
|
|
// ESP32 mount paths are short names ("/system"); POSIX file systems can return a full
|
|
// absolute host path instead, so take the last path component either way.
|
|
auto path_str = std::string(path);
|
|
auto slash_pos = path_str.find_last_of('/');
|
|
auto mount_name = slash_pos == std::string::npos ? path_str : path_str.substr(slash_pos + 1);
|
|
if (!config::SHOW_SYSTEM_PARTITION && mount_name.starts_with(SYSTEM_PARTITION_NAME)) return true;
|
|
auto dir_entry = dirent {
|
|
.d_ino = 2,
|
|
.d_type = TT_DT_DIR,
|
|
.d_name = { 0 }
|
|
};
|
|
auto& dir_entries = *static_cast<std::vector<dirent>*>(context);
|
|
strcpy(dir_entry.d_name, mount_name.c_str());
|
|
dir_entries.push_back(dir_entry);
|
|
|
|
return true;
|
|
});
|
|
|
|
return dir_entries;
|
|
}
|
|
|
|
}
|