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

Account carriage returns when processing files (closes https://github.com/HamletDuFromage/aio-switch-updater/issues/210)

This commit is contained in:
flb 2022-09-07 20:41:16 +02:00
parent cf45b0b896
commit 08d6e1f23f
2 changed files with 12 additions and 9 deletions

View file

@ -114,7 +114,7 @@ namespace extract {
}
if (appPath != 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);
u8 res = filename.find(ignored);
return (res == 0 || res == 1); }) != ignoreList.end()) {
if (!std::filesystem::exists(filename)) {
extractEntry(filename, zfile);

View file

@ -106,16 +106,19 @@ namespace fs {
std::set<std::string> readLineByLine(const std::string& path)
{
std::set<std::string> titles;
std::string str;
std::ifstream in(path);
if (in) {
while (std::getline(in, str)) {
if (str.size() > 0)
titles.insert(str);
std::set<std::string> res;
std::ifstream lines(path);
std::string line;
if (lines) {
while (std::getline(lines, line)) {
if (line.size() > 0) {
if (line.back() == '\r')
line.pop_back();
res.insert(line);
}
}
}
return titles;
return res;
}
Result getFreeStorageSD(s64& free)