MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / getFileSystemDirents

Function getFileSystemDirents

Tactility/Source/MountPoints.cpp:15–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13namespace tt::file {
14
15std::vector<dirent> getFileSystemDirents() {
16 std::vector<dirent> dir_entries;
17
18 file_system_for_each(&dir_entries, [](auto* fs, void* context) {
19 if (!file_system_is_mounted(fs)) return true;
20 char path[128];
21 if (file_system_get_path(fs, path, sizeof(path)) != ERROR_NONE) return true;
22 auto mount_name = std::string(path).substr(1);
23 if (!config::SHOW_SYSTEM_PARTITION && mount_name.starts_with(SYSTEM_PARTITION_NAME)) return true;
24 auto dir_entry = dirent {
25 .d_ino = 2,
26 .d_type = TT_DT_DIR,
27 .d_name = { 0 }
28 };
29 auto& dir_entries = *static_cast<std::vector<dirent>*>(context);
30 strcpy(dir_entry.d_name, mount_name.c_str());
31 dir_entries.push_back(dir_entry);
32
33 return true;
34 });
35
36 return dir_entries;
37}
38
39}

Callers 3

handleFsTreeMethod · 0.85
setEntriesForPathMethod · 0.85
setEntriesForPathMethod · 0.85

Calls 3

file_system_for_eachFunction · 0.85
file_system_is_mountedFunction · 0.85
file_system_get_pathFunction · 0.85

Tested by

no test coverage detected