mirror of
https://github.com/Huntereb/Awoo-Installer
synced 2024-11-23 04:03:10 +00:00
Tell how many nsps installed, and which ones failed to install
This commit is contained in:
parent
e3e07541d8
commit
9a59359bd0
2 changed files with 21 additions and 19 deletions
|
@ -121,14 +121,15 @@ namespace netInstStuff{
|
|||
FsStorageId m_destStorageId = FsStorageId_SdCard;
|
||||
|
||||
if (ourStorage) m_destStorageId = FsStorageId_NandUser;
|
||||
unsigned int urlItr;
|
||||
|
||||
try {
|
||||
for (unsigned int i = 0; i < ourUrlList.size(); i++) {
|
||||
inst::ui::setTopInstInfoText("Installing " + inst::util::shortenString(inst::util::formatUrlString(ourUrlList[i]), 48, true));
|
||||
for (urlItr = 0; urlItr < ourUrlList.size(); urlItr++) {
|
||||
inst::ui::setTopInstInfoText("Installing " + inst::util::shortenString(inst::util::formatUrlString(ourUrlList[urlItr]), 48, true));
|
||||
|
||||
tin::install::nsp::HTTPNSP httpNSP(ourUrlList[i]);
|
||||
tin::install::nsp::HTTPNSP httpNSP(ourUrlList[urlItr]);
|
||||
|
||||
printf("%s %s\n", "Install request from", ourUrlList[i].c_str());
|
||||
printf("%s %s\n", "Install request from", ourUrlList[urlItr].c_str());
|
||||
tin::install::nsp::RemoteNSPInstall install(m_destStorageId, inst::config::ignoreReqVers, &httpNSP);
|
||||
|
||||
printf("%s\n", "Preparing installation");
|
||||
|
@ -142,9 +143,9 @@ namespace netInstStuff{
|
|||
printf("Failed to install");
|
||||
printf("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::setInstInfoText("Failed to install");
|
||||
inst::ui::setInstInfoText("Failed to install " + inst::util::shortenString(ourUrlList[urlItr].erase(0, 6), 48, true));
|
||||
inst::ui::setInstBarPerc(0);
|
||||
inst::ui::mainApp->CreateShowDialog("Failed to install!", "Partially installed contents can be removed from the System Settings applet.\n\n" + (std::string)e.what(), {"OK"}, true);
|
||||
inst::ui::mainApp->CreateShowDialog("Failed to install " + inst::util::shortenString(ourUrlList[urlItr].erase(0, 6), 48, true) + "!", "Partially installed contents can be removed from the System Settings applet.\n\n" + (std::string)e.what(), {"OK"}, true);
|
||||
nspInstalled = false;
|
||||
}
|
||||
|
||||
|
@ -156,7 +157,7 @@ namespace netInstStuff{
|
|||
if(nspInstalled) {
|
||||
inst::ui::setInstInfoText("Install complete");
|
||||
inst::ui::setInstBarPerc(100);
|
||||
if (ourUrlList.size() > 1) inst::ui::mainApp->CreateShowDialog("Selected files installed!", nspInstStuff::finishedMessage(), {"OK"}, true);
|
||||
if (ourUrlList.size() > 1) inst::ui::mainApp->CreateShowDialog(std::to_string(ourUrlList.size()) + " files installed successfully!", nspInstStuff::finishedMessage(), {"OK"}, true);
|
||||
else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(inst::util::formatUrlString(ourUrlList[0]), 48, true) + " installed!", nspInstStuff::finishedMessage(), {"OK"}, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -90,21 +90,22 @@ namespace nspInstStuff {
|
|||
std::vector<std::string> oldNamesOfFiles = {};
|
||||
|
||||
if (whereToInstall) m_destStorageId = FsStorageId_NandUser;
|
||||
unsigned int nspItr;
|
||||
|
||||
try
|
||||
{
|
||||
for (unsigned int i = 0; i < ourNspList.size(); i++) {
|
||||
inst::ui::setTopInstInfoText("Installing " + inst::util::shortenString(ourNspList[i].string().erase(0, 6), 48, true));
|
||||
for (nspItr = 0; nspItr < ourNspList.size(); nspItr++) {
|
||||
inst::ui::setTopInstInfoText("Installing " + inst::util::shortenString(ourNspList[nspItr].string().erase(0, 6), 48, true));
|
||||
|
||||
if (ourNspList[i].extension() == ".nsz") {
|
||||
oldNamesOfFiles.push_back(ourNspList[i]);
|
||||
std::string newfilename = ourNspList[i].string().substr(0, ourNspList[i].string().find_last_of('.'))+"_temp.nsp";
|
||||
rename(ourNspList[i], newfilename);
|
||||
if (ourNspList[nspItr].extension() == ".nsz") {
|
||||
oldNamesOfFiles.push_back(ourNspList[nspItr]);
|
||||
std::string newfilename = ourNspList[nspItr].string().substr(0, ourNspList[nspItr].string().find_last_of('.'))+"_temp.nsp";
|
||||
rename(ourNspList[nspItr], newfilename);
|
||||
filesToBeRenamed.push_back(newfilename);
|
||||
ourNspList[i] = newfilename;
|
||||
ourNspList[nspItr] = newfilename;
|
||||
}
|
||||
|
||||
std::string path = "@Sdcard://" + ourNspList[i].string().erase(0, 6);
|
||||
std::string path = "@Sdcard://" + ourNspList[nspItr].string().erase(0, 6);
|
||||
|
||||
nx::fs::IFileSystem fileSystem;
|
||||
fileSystem.OpenFileSystemWithId(path, FsFileSystemType_ApplicationPackage, 0);
|
||||
|
@ -123,9 +124,9 @@ namespace nspInstStuff {
|
|||
printf("Failed to install");
|
||||
printf("%s", e.what());
|
||||
fprintf(stdout, "%s", e.what());
|
||||
inst::ui::setInstInfoText("Failed to install");
|
||||
inst::ui::setInstInfoText("Failed to install " + inst::util::shortenString(ourNspList[nspItr].string().erase(0, 6), 48, true));
|
||||
inst::ui::setInstBarPerc(0);
|
||||
inst::ui::mainApp->CreateShowDialog("Failed to install!", "Partially installed contents can be removed from the System Settings applet.\n\n" + (std::string)e.what(), {"OK"}, true);
|
||||
inst::ui::mainApp->CreateShowDialog("Failed to install " + inst::util::shortenString(ourNspList[nspItr].string().erase(0, 6), 48, true) + "!", "Partially installed contents can be removed from the System Settings applet.\n\n" + (std::string)e.what(), {"OK"}, true);
|
||||
nspInstalled = false;
|
||||
}
|
||||
|
||||
|
@ -141,12 +142,12 @@ namespace nspInstStuff {
|
|||
inst::ui::setInstBarPerc(100);
|
||||
if (ourNspList.size() > 1) {
|
||||
if (inst::config::deletePrompt) {
|
||||
if(inst::ui::mainApp->CreateShowDialog("Selected files installed! Delete them from the SD card?", "NSP and NSZ files aren't needed anymore after they've been installed", {"No","Yes"}, false) == 1) {
|
||||
if(inst::ui::mainApp->CreateShowDialog(std::to_string(ourNspList.size()) + " files installed successfully! Delete them from the SD card?", "NSP and NSZ files aren't needed anymore after they've been installed", {"No","Yes"}, false) == 1) {
|
||||
for (long unsigned int i = 0; i < ourNspList.size(); i++) {
|
||||
if (std::filesystem::exists(ourNspList[i])) std::filesystem::remove(ourNspList[i]);
|
||||
}
|
||||
}
|
||||
} else inst::ui::mainApp->CreateShowDialog("Selected files installed!", nspInstStuff::finishedMessage(), {"OK"}, true);
|
||||
} else inst::ui::mainApp->CreateShowDialog(std::to_string(ourNspList.size()) + " files installed successfully!", nspInstStuff::finishedMessage(), {"OK"}, true);
|
||||
} else {
|
||||
if (inst::config::deletePrompt) {
|
||||
if(inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourNspList[0].string().erase(0, 6), 48, true) + " installed! Delete it from the SD card?", "NSP and NSZ files aren't needed anymore after they've been installed", {"No","Yes"}, false) == 1) if (std::filesystem::exists(ourNspList[0])) std::filesystem::remove(ourNspList[0]);
|
||||
|
|
Loading…
Reference in a new issue