PKG installer fix

This commit is contained in:
Nekotekina 2016-07-18 21:28:58 +03:00
parent a186af32ec
commit 04926374f7
1 changed files with 9 additions and 1 deletions

View File

@ -283,13 +283,15 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event))
if (pkg_install(pkg_f, local_path + '/', progress))
{
progress = 1.;
return_;
}
// TODO: Ask user to delete files on cancellation/failure?
progress = -1.;
});
// Wait for the completion
while (std::this_thread::sleep_for(5ms), progress < 1.)
while (std::this_thread::sleep_for(5ms), std::abs(progress) < 1.)
{
// Update progress window
if (!pdlg.Update(static_cast<int>(progress * pdlg.GetRange())))
@ -299,6 +301,12 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event))
break;
}
}
if (progress > 0.)
{
pdlg.Update(pdlg.GetRange());
std::this_thread::sleep_for(100ms);
}
}
pdlg.Close();