[nostalgia/tools/pack] Cleanup

This commit is contained in:
Gary Talent 2021-05-08 23:00:55 -05:00
parent eb207b2d6c
commit fee5a33da1

View File

@ -37,8 +37,7 @@ static ox::Error transformClaw(ox::FileSystem *dest, const ox::String &path) noe
// copy // copy
oxTracef("pack::transformClaw", "path: {}", path); oxTracef("pack::transformClaw", "path: {}", path);
oxRequire(fileList, dest->ls(path)); oxRequire(fileList, dest->ls(path));
for (auto i = 0u; i < fileList.size(); ++i) { for (const auto &name : fileList) {
const auto &name = fileList[i];
const auto filePath = path + name; const auto filePath = path + name;
oxRequire(stat, dest->stat(filePath.c_str())); oxRequire(stat, dest->stat(filePath.c_str()));
if (stat.fileType == ox::FileType_Directory) { if (stat.fileType == ox::FileType_Directory) {
@ -77,8 +76,7 @@ static ox::Error copy(ox::FileSystem *src, ox::FileSystem *dest, const ox::Strin
ox::Vector<VerificationPair> verificationPairs; ox::Vector<VerificationPair> verificationPairs;
// copy // copy
oxRequire(fileList, src->ls(path)); oxRequire(fileList, src->ls(path));
for (auto i = 0u; i < fileList.size(); ++i) { for (const auto &name : fileList) {
const auto &name = fileList[i];
const auto currentFile = path + name; const auto currentFile = path + name;
if (currentFile == "/.nostalgia") { if (currentFile == "/.nostalgia") {
continue; continue;
@ -101,8 +99,7 @@ static ox::Error copy(ox::FileSystem *src, ox::FileSystem *dest, const ox::Strin
} }
} }
// verify all at once in addition to right after the files are written // verify all at once in addition to right after the files are written
for (auto i = 0u; i < verificationPairs.size(); ++i) { for (const auto &v : verificationPairs) {
const auto &v = verificationPairs[i];
oxReturnError(verifyFile(dest, v.path, v.buff)); oxReturnError(verifyFile(dest, v.path, v.buff));
} }
return OxError(0); return OxError(0);