1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-12-01 05:42:02 +00:00

ensure extraction in correct directory

This commit is contained in:
flb 2022-08-10 14:27:04 +02:00
parent 1e9f453998
commit 7b34afc414
2 changed files with 6 additions and 5 deletions

View file

@ -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 NRO_PATH[] = "/switch/aio-switch-updater/aio-switch-updater.nro";
constexpr const char DOWNLOAD_PATH[] = "/config/aio-switch-updater/"; constexpr const char DOWNLOAD_PATH[] = "/config/aio-switch-updater/";
constexpr const char CONFIG_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 CONFIG_PATH_UNZIP[] = "config\\aio-switch-updater";
constexpr const char RCM_PAYLOAD_PATH[] = "romfs:/aio_rcm.bin"; constexpr const char RCM_PAYLOAD_PATH[] = "romfs:/aio_rcm.bin";

View file

@ -114,21 +114,21 @@ namespace extract {
break; break;
} }
if (appPath != workingPath + filename) { if (appPath != workingPath + filename) {
if ((overwriteInis == 0 && filename.substr(filename.length() - 4) == ".ini") || std::find_if(ignoreList.begin(), ignoreList.end(), [&filename](std::string ignored) { if ((overwriteInis == 0 && filename.substr(filename.length() - 4) == ".ini") || std::find_if(ignoreList.begin(), ignoreList.end(), [&filename, &workingPath](std::string ignored) {
u8 res = ("/" + filename).find(ignored); u8 res = (workingPath + filename).find(ignored);
return (res == 0 || res == 1); }) != ignoreList.end()) { return (res == 0 || res == 1); }) != ignoreList.end()) {
if (!std::filesystem::exists("/" + filename)) { if (!std::filesystem::exists(workingPath + filename)) {
extractEntry(filename, zfile); extractEntry(filename, zfile);
} }
} }
else { else {
if ((filename == "atmosphere/package3") || (filename == "atmosphere/stratosphere.romfs")) { if ((filename == "atmosphere/package3") || (filename == "atmosphere/stratosphere.romfs")) {
extractEntry(filename += ".aio", zfile); extractEntry(filename + ".aio", zfile);
} }
else { else {
extractEntry(filename, zfile); extractEntry(filename, zfile);
if (filename.substr(0, 13) == "hekate_ctcaer") { 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) { 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); fs::copyFile(UPDATE_BIN_PATH, REBOOT_PAYLOAD_PATH);
} }