1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-24 18:42:05 +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 (appPath != 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](std::string ignored) {
u8 res = (filename).find(ignored); u8 res = 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(filename)) {
extractEntry(filename, zfile); extractEntry(filename, zfile);

View file

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