| 43 | } |
| 44 | |
| 45 | Result RemotePcExploreLayout::Reload() { |
| 46 | g_Settings.ApplyToMenu(this->paths_menu); |
| 47 | g_MainApplication->LoadMenuData(true, cfg::Strings.GetString(299), GetCommonIcon(CommonIconKind::Pc), cfg::Strings.GetString(152)); |
| 48 | ScopeGuard cancel_guard([this]() { |
| 49 | g_MainApplication->PopMenuData(); |
| 50 | }); |
| 51 | |
| 52 | SleepWhileRender(100'000'000); |
| 53 | |
| 54 | this->names.clear(); |
| 55 | this->paths.clear(); |
| 56 | this->paths_menu->ClearItems(); |
| 57 | |
| 58 | u32 drive_count; |
| 59 | auto rc = usb::cf::GetDriveCount(drive_count); |
| 60 | if(R_SUCCEEDED(rc)) { |
| 61 | for(u32 i = 0; i < drive_count; i++) { |
| 62 | std::string label; |
| 63 | std::string path; |
| 64 | size_t tmp_total_size; |
| 65 | size_t tmp_free_size; |
| 66 | // TODO (low priority): make use of drive sizes? |
| 67 | rc = usb::cf::GetDriveInfo(i, label, path, tmp_total_size, tmp_free_size); |
| 68 | if(R_SUCCEEDED(rc)) { |
| 69 | this->names.push_back(label); |
| 70 | this->paths.push_back(path); |
| 71 | } |
| 72 | else { |
| 73 | HandleResult(rc, cfg::Strings.GetString(256)); |
| 74 | return rc; |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | else { |
| 79 | HandleResult(rc, cfg::Strings.GetString(256)); |
| 80 | return rc; |
| 81 | } |
| 82 | |
| 83 | u32 path_count; |
| 84 | rc = usb::cf::GetSpecialPathCount(path_count); |
| 85 | if(R_SUCCEEDED(rc)) { |
| 86 | for(u32 i = 0; i < path_count; i++) { |
| 87 | std::string name; |
| 88 | std::string path; |
| 89 | rc = usb::cf::GetSpecialPath(i, name, path); |
| 90 | if(R_SUCCEEDED(rc)) { |
| 91 | this->names.push_back(name); |
| 92 | this->paths.push_back(path); |
| 93 | } |
| 94 | else { |
| 95 | HandleResult(rc, cfg::Strings.GetString(256)); |
| 96 | return rc; |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | else { |
| 101 | HandleResult(rc, cfg::Strings.GetString(256)); |
| 102 | return rc; |
nothing calls this directly
no test coverage detected