| 243 | } |
| 244 | |
| 245 | void HandleInstallationFailure(const Result rc, nsp::Installer &nsp_installer) { |
| 246 | for(const auto &program: nsp_installer.GetInstallablePrograms()) { |
| 247 | const auto program_id = program.meta_key.id; |
| 248 | auto program_app = cnt::ExistsApplicationContent(program_id, static_cast<NcmContentMetaType>(program.meta_key.type)); |
| 249 | if(program_app.has_value()) { |
| 250 | GLEAF_LOG_FMT("Removing program %016lX failed installation leftovers...", program_id); |
| 251 | |
| 252 | const auto &cnt_status = program_app.value().get().meta_status_list; |
| 253 | const auto cnt_it = std::find_if(cnt_status.begin(), cnt_status.end(), [&](const NsApplicationContentMetaStatus &cnt_status) -> bool { |
| 254 | return cnt_status.application_id == program_id; |
| 255 | }); |
| 256 | if(cnt_it != cnt_status.end()) { |
| 257 | GLEAF_LOG_FMT("Removing program %016lX...", program_id); |
| 258 | const auto cnt_idx = std::distance(cnt_status.begin(), cnt_it); |
| 259 | cnt::RemoveApplicationContentById(program_app.value().get(), cnt_idx); |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | HandleResult(rc, cfg::Strings.GetString(251)); |
| 265 | } |
| 266 | |
| 267 | } |
| 268 |
no test coverage detected