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

pass entries as references

pass entries as references
This commit is contained in:
flb 2021-05-29 14:48:11 +02:00
parent 459d1176b3
commit f999575e4f

View file

@ -35,8 +35,8 @@ void extract(const std::string& filename, const std::string& workingPath, int o
ProgressEvent::instance().setTotalSteps(entries.size() + 1); ProgressEvent::instance().setTotalSteps(entries.size() + 1);
for (const auto& entry : entries) { for (const auto& entry : entries) {
if((overwriteInis == 0 && entry.name.substr(entry.name.length() - 4) == ".ini") if((overwriteInis == 0 && entry.name.substr(entry.name.length() - 4) == ".ini")
|| find_if(ignoreList.begin(), ignoreList.end(), [entry](std::string ignoreList) { || find_if(ignoreList.begin(), ignoreList.end(), [&entry](std::string ignored) {
u8 res = ("/" + entry.name).find(ignoreList); u8 res = ("/" + entry.name).find(ignored);
return (res == 0 || res == 1); }) != ignoreList.end()) return (res == 0 || res == 1); }) != ignoreList.end())
{ {
if(!std::filesystem::exists("/" + entry.name)) { if(!std::filesystem::exists("/" + entry.name)) {
@ -69,8 +69,8 @@ void extract(const std::string& filename, const std::string& workingPath, const
std::vector<zipper::ZipEntry> entries = unzipper.entries(); std::vector<zipper::ZipEntry> entries = unzipper.entries();
ProgressEvent::instance().setTotalSteps(entries.size() + 1); ProgressEvent::instance().setTotalSteps(entries.size() + 1);
for (const auto& entry : entries) { for (const auto& entry : entries) {
if(find_if(ignoreList.begin(), ignoreList.end(), [entry](std::string ignoreList) { if(find_if(ignoreList.begin(), ignoreList.end(), [&entry](std::string ignored) {
u8 res = ("/" + entry.name).find(ignoreList); u8 res = ("/" + entry.name).find(ignored);
return (res == 0 || res == 1); }) != ignoreList.end()) return (res == 0 || res == 1); }) != ignoreList.end())
{ {
if(!std::filesystem::exists("/" + entry.name)){ if(!std::filesystem::exists("/" + entry.name)){