From 8bbfaac3363f8a3e0e333783295e8e8d5b11298f Mon Sep 17 00:00:00 2001 From: Huntereb Date: Thu, 19 Dec 2019 19:27:38 -0500 Subject: [PATCH] Releases should be zip files, so we should extract them --- romfs/lang/en.json | 1 + source/ui/optionsPage.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/romfs/lang/en.json b/romfs/lang/en.json index 044b6ac..a6fddc7 100755 --- a/romfs/lang/en.json +++ b/romfs/lang/en.json @@ -165,6 +165,7 @@ "opt0": "Update", "top_info": "Updating to Awoo Installer ", "bot_info": "Downloading Awoo Installer ", + "bot_info2": "Extracting Awoo Installer ", "complete": "Update complete!", "failed": "Update failed!", "end_desc": "The software will now be closed.", diff --git a/source/ui/optionsPage.cpp b/source/ui/optionsPage.cpp index 72a9c02..5aae9e7 100755 --- a/source/ui/optionsPage.cpp +++ b/source/ui/optionsPage.cpp @@ -7,6 +7,7 @@ #include "util/util.hpp" #include "util/config.hpp" #include "util/curl.hpp" +#include "util/unzip.hpp" #include "util/lang.hpp" #include "ui/instPage.hpp" @@ -50,12 +51,12 @@ namespace inst::ui { inst::ui::instPage::setInstBarPerc(0); inst::ui::instPage::setInstInfoText("options.update.bot_info"_lang + updateInfo[0]); try { - romfsExit(); - std::string curName = inst::config::appDir + "/Awoo-Installer.nro"; - std::string downloadName = inst::config::appDir + "/temp_download"; + std::string downloadName = inst::config::appDir + "/temp_download.zip"; inst::curl::downloadFile(updateInfo[1], downloadName.c_str(), 0, true); - if (std::filesystem::exists(curName)) std::filesystem::remove(curName); - std::filesystem::rename(downloadName, curName); + romfsExit(); + inst::ui::instPage::setInstInfoText("options.update.bot_info2"_lang + updateInfo[0]); + inst::zip::extractFile(downloadName, "sdmc:/"); + std::filesystem::remove(downloadName); mainApp->CreateShowDialog("options.update.complete"_lang, "options.update.end_desc"_lang, {"common.ok"_lang}, false); } catch (...) { mainApp->CreateShowDialog("options.update.failed"_lang, "options.update.end_desc"_lang, {"common.ok"_lang}, false);