From 7b34afc414c54bbffdaab886e296b5a68cc0fcea Mon Sep 17 00:00:00 2001 From: flb Date: Wed, 10 Aug 2022 14:27:04 +0200 Subject: [PATCH] ensure extraction in correct directory --- include/constants.hpp | 1 + source/extract.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/constants.hpp b/include/constants.hpp index ffaa549..b4768bc 100644 --- a/include/constants.hpp +++ b/include/constants.hpp @@ -5,6 +5,7 @@ constexpr const char APP_PATH[] = "/switch/aio-switch-updater/"; constexpr const char NRO_PATH[] = "/switch/aio-switch-updater/aio-switch-updater.nro"; constexpr const char DOWNLOAD_PATH[] = "/config/aio-switch-updater/"; constexpr const char CONFIG_PATH[] = "/config/aio-switch-updater/"; +constexpr const char CONFIG_FILE[] = "/config/aio-switch-updater/config.json"; constexpr const char CONFIG_PATH_UNZIP[] = "config\\aio-switch-updater"; constexpr const char RCM_PAYLOAD_PATH[] = "romfs:/aio_rcm.bin"; diff --git a/source/extract.cpp b/source/extract.cpp index 48520b4..f209bd9 100644 --- a/source/extract.cpp +++ b/source/extract.cpp @@ -114,21 +114,21 @@ namespace extract { break; } if (appPath != workingPath + filename) { - if ((overwriteInis == 0 && filename.substr(filename.length() - 4) == ".ini") || std::find_if(ignoreList.begin(), ignoreList.end(), [&filename](std::string ignored) { - u8 res = ("/" + filename).find(ignored); + if ((overwriteInis == 0 && filename.substr(filename.length() - 4) == ".ini") || std::find_if(ignoreList.begin(), ignoreList.end(), [&filename, &workingPath](std::string ignored) { + u8 res = (workingPath + filename).find(ignored); return (res == 0 || res == 1); }) != ignoreList.end()) { - if (!std::filesystem::exists("/" + filename)) { + if (!std::filesystem::exists(workingPath + filename)) { extractEntry(filename, zfile); } } else { if ((filename == "atmosphere/package3") || (filename == "atmosphere/stratosphere.romfs")) { - extractEntry(filename += ".aio", zfile); + extractEntry(filename + ".aio", zfile); } else { extractEntry(filename, zfile); if (filename.substr(0, 13) == "hekate_ctcaer") { - fs::copyFile("/" + filename, UPDATE_BIN_PATH); + fs::copyFile(workingPath + filename, UPDATE_BIN_PATH); if (CurrentCfw::running_cfw == CFW::ams && util::showDialogBoxBlocking(fmt::format("menus/utils/set_hekate_reboot_payload"_i18n, UPDATE_BIN_PATH, REBOOT_PAYLOAD_PATH), "menus/common/yes"_i18n, "menus/common/no"_i18n) == 0) { fs::copyFile(UPDATE_BIN_PATH, REBOOT_PAYLOAD_PATH); }