| 738 | } |
| 739 | |
| 740 | void BoxedContainer::installTinyCorePackage(BString package) { |
| 741 | std::vector<BString> todo; |
| 742 | std::vector<BString> needsDownload; |
| 743 | |
| 744 | todo.push_back(B("")); // signal last package, should do ldconfig |
| 745 | getTinyCorePackages(package, todo, needsDownload); |
| 746 | |
| 747 | if (todo.size()==1) { |
| 748 | return; |
| 749 | } |
| 750 | if (!needsDownload.size()) { |
| 751 | doInstallTinyCorePackage(todo); |
| 752 | } else { |
| 753 | BString location = getCacheFolder(); |
| 754 | if (!Fs::doesNativePathExist(location)) { |
| 755 | Fs::makeNativeDirs(location); |
| 756 | } |
| 757 | std::shared_ptr<FileSystemZip> fileSystem = this->fileSystem.lock(); |
| 758 | std::vector<DownloadItem> items; |
| 759 | for (auto& package : needsDownload) { |
| 760 | items.push_back(DownloadItem(getTranslationWithFormat(Msg::DOWNLOADDLG_LABEL, true, package), fileSystem->tinyCoreURL + package, B(""), location.stringByApppendingPath(package), 0)); |
| 761 | } |
| 762 | runOnMainUI([this, items, todo]() { |
| 763 | new DownloadDlg(Msg::DOWNLOADDLG_TITLE, items, [this, todo](bool success) { |
| 764 | runOnMainUI([success, this, todo]() { |
| 765 | if (success) { |
| 766 | doInstallTinyCorePackage(todo); |
| 767 | } |
| 768 | return false; |
| 769 | }); |
| 770 | }); |
| 771 | return false; |
| 772 | }); |
| 773 | } |
| 774 | |
| 775 | } |
| 776 | |
| 777 | void BoxedContainer::installNextTinyCorePackage(WaitDlg* dlg, std::vector<BString> packages) { |
| 778 | if (packages.size() == 0) { |
no test coverage detected