Skip to content

Commit

Permalink
feat: improved installer error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
zziger committed Aug 18, 2024
1 parent e2de8b9 commit f9e1bae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/supermod/modloader/install/ModInstaller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,26 @@ class ModInstaller
installing = true;
installingCurrentRequest = 0;

UpdateCandidates();
try
{
UpdateCandidates();
for (int i = 0; i < candidateRequests.size(); i++)
{
installingCurrentRequest = i;
auto source = candidateRequests[i]->GetActiveSource();
if (source == nullptr)
continue;
co_await source->Install();
try
{
co_await source->Install();
}
catch (std::exception& e)
{
installing = false;
ui::NotificationManager::Notify("Ошибка при установке мода " +
candidateRequests[i]->GetModInfo()->title + ": " +
std::string(e.what()));
}
}
}
catch (std::exception& e)
Expand Down
2 changes: 1 addition & 1 deletion src/supermod/ui/windows/installerWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void sm::ui::windows::Installer()
if (modloader::ModInstaller::IsInstalling())
{

ImGui::SetNextWindowSize(ImVec2{600, 0}, ImGuiCond_Appearing);
ImGui::SetNextWindowSize(ImVec2{600, 0}, ImGuiCond_Always);
if (ImGui::Begin("Установка модов", nullptr,
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize))
{
Expand Down

0 comments on commit f9e1bae

Please sign in to comment.