Tactility/Tactility/Source/MountPoints.cpp
Ken Van Hoeylandt 2a2558b29a
Remove old HAL components and refactored GPS-related code (#583)
- Added generic GPS/GNSS support with device detection, configuration, and persistent settings.
- Improved device and module lifecycle management.
- Added flexible filesystem locking support for displays and storage.
- Improved display-idle and keyboard backlight handling.
- Updated architecture, driver, module, testing, and licensing documentation.
- Removed old HAL device and related code.
2026-07-25 17:20:17 +02:00

39 lines
1.0 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;
auto mount_name = std::string(path).substr(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;
}
}