| 18 | } |
| 19 | |
| 20 | FileSystem* findSdcardFileSystem(bool mustBeMounted) { |
| 21 | FileSystem* found = nullptr; |
| 22 | file_system_for_each(&found, [](auto* fs, void* context) { |
| 23 | char path[128]; |
| 24 | if (file_system_get_path(fs, path, sizeof(path)) != ERROR_NONE) return true; |
| 25 | // TODO: Find a better way to identify SD card paths |
| 26 | if (std::string(path).starts_with("/sdcard")) { |
| 27 | *static_cast<FileSystem**>(context) = fs; |
| 28 | return false; |
| 29 | } |
| 30 | return true; |
| 31 | }); |
| 32 | if (found && mustBeMounted && !file_system_is_mounted(found)) { |
| 33 | return nullptr; |
| 34 | } |
| 35 | return found; |
| 36 | } |
| 37 | |
| 38 | std::string getSystemRootPath() { |
| 39 | std::string root_path; |
no test coverage detected