1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-12-29 10:56:01 +00:00

default to not overwriting .inis

This commit is contained in:
flb 2022-11-04 02:24:45 +01:00
parent c305fdad06
commit 2c4d930b5f
5 changed files with 13 additions and 10 deletions

View file

@ -22,7 +22,7 @@ DATA := data
INCLUDES := include /lib/borealis/library/include/borealis/extern/nlohmann
APP_TITLE := All-in-One Switch Updater
APP_AUTHOR := HamletDuFromage
APP_VERSION := 2.21.0
APP_VERSION := 2.21.1
TARGET := $(notdir $(CURDIR))
ROMFS := resources

View file

@ -27,7 +27,7 @@ namespace extract {
} Title;
void extract(
const std::string& filename, const std::string& workingPath = ROOT_PATH, int overwriteInis = 1, std::function<void()> func = []() { return; });
const std::string& filename, const std::string& workingPath = ROOT_PATH, bool preserveInis = false, std::function<void()> func = []() { return; });
std::vector<std::string> getInstalledTitlesNs();
std::vector<std::string> excludeTitles(const std::string& path, const std::vector<std::string>& listedTitles);
void writeTitlesToFile(const std::set<std::string>& titles, const std::string& path);

View file

@ -258,6 +258,9 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
verTitles.push_back("v2.21.0");
changes.push_back("\uE016 Managing custom download links is now possible directly from the app.\n\uE016 Toggle/untoggle all games in cheats menu->exclude games from receiving cheat updates.");
verTitles.push_back("v2.21.0");
changes.push_back("\uE016 Dialogs now default to not overwriting .ini files");
for (int i = verTitles.size() - 1; i >= 0; i--) {
listItem = new brls::ListItem(verTitles[i]);
change = changes[i];

View file

@ -88,7 +88,7 @@ namespace extract {
}
} // namespace
void extract(const std::string& archivePath, const std::string& workingPath, int overwriteInis, std::function<void()> func)
void extract(const std::string& archivePath, const std::string& workingPath, bool preserveInis, std::function<void()> func)
{
ensureAvailableStorage(archivePath);
@ -113,7 +113,7 @@ namespace extract {
break;
}
if (appPath != filename) {
if ((overwriteInis == 0 && filename.substr(filename.length() - 4) == ".ini") || std::find_if(ignoreList.begin(), ignoreList.end(), [&filename](std::string ignored) {
if ((preserveInis == true && filename.substr(filename.length() - 4) == ".ini") || std::find_if(ignoreList.begin(), ignoreList.end(), [&filename](std::string ignored) {
u8 res = filename.find(ignored);
return (res == 0 || res == 1); }) != ignoreList.end()) {
if (!std::filesystem::exists(filename)) {

View file

@ -173,21 +173,21 @@ namespace util {
fs::copyFile(ROMFS_FORWARDER, FORWARDER_PATH);
break;
case contentType::custom: {
int overwriteInis = showDialogBoxBlocking("menus/utils/overwrite_inis"_i18n, "menus/common/no"_i18n, "menus/common/yes"_i18n);
extract::extract(CUSTOM_FILENAME, ROOT_PATH, overwriteInis);
int preserveInis = showDialogBoxBlocking("menus/utils/overwrite_inis"_i18n, "menus/common/yes"_i18n, "menus/common/no"_i18n);
extract::extract(CUSTOM_FILENAME, ROOT_PATH, preserveInis);
break;
}
case contentType::bootloaders: {
int overwriteInis = showDialogBoxBlocking("menus/utils/overwrite_inis"_i18n, "menus/common/no"_i18n, "menus/common/yes"_i18n);
extract::extract(BOOTLOADER_FILENAME, ROOT_PATH, overwriteInis);
int preserveInis = showDialogBoxBlocking("menus/utils/overwrite_inis"_i18n, "menus/common/yes"_i18n, "menus/common/no"_i18n);
extract::extract(BOOTLOADER_FILENAME, ROOT_PATH, preserveInis);
break;
}
case contentType::ams_cfw: {
int overwriteInis = showDialogBoxBlocking("menus/utils/overwrite_inis"_i18n, "menus/common/no"_i18n, "menus/common/yes"_i18n);
int preserveInis = showDialogBoxBlocking("menus/utils/overwrite_inis"_i18n, "menus/common/yes"_i18n, "menus/common/no"_i18n);
int deleteContents = showDialogBoxBlocking("menus/ams_update/delete_sysmodules_flags"_i18n, "menus/common/no"_i18n, "menus/common/yes"_i18n);
if (deleteContents == 1)
removeSysmodulesFlags(AMS_CONTENTS);
extract::extract(AMS_FILENAME, ROOT_PATH, overwriteInis);
extract::extract(AMS_FILENAME, ROOT_PATH, preserveInis);
break;
}
default: