[nostalgia/tools/pack] Add Bullock integration and cleanup FS access

This commit is contained in:
2023-02-01 22:41:04 -06:00
parent 1cc3549d00
commit fad8837ad1
3 changed files with 15 additions and 4 deletions
+3 -3
View File
@@ -32,7 +32,7 @@ static ox::Error pathToInode(ox::FileSystem *dest, ox::ModelObject *obj) noexcep
case ox::FileAddressType::None:
return {};
}
oxRequire(s, dest->stat(ox::StringView(path)));
oxRequire(s, dest->stat(path));
oxReturnError(o["type"].set(static_cast<int8_t>(ox::FileAddressType::Inode)));
return data.set(2, s.inode);
}
@@ -121,7 +121,7 @@ static ox::Error copy(ox::FileSystem *src, ox::FileSystem *dest, ox::CRStringVie
continue;
}
oxOutf("reading {}\n", currentFile);
oxRequire(stat, src->stat(ox::StringView(currentFile)));
oxRequire(stat, src->stat(currentFile));
if (stat.fileType == ox::FileType::Directory) {
oxReturnError(dest->mkdir(currentFile, true));
oxReturnError(copy(src, dest, currentFile + '/'));
@@ -171,7 +171,7 @@ static ox::Error preloadDir(core::TypeStore *ts, ox::FileSystem *romFs, GbaPrelo
oxRequire(fileList, romFs->ls(path));
for (const auto &name : fileList) {
const auto filePath = ox::sfmt("{}{}", path, name);
oxRequire(stat, romFs->stat(ox::StringView(filePath)));
oxRequire(stat, romFs->stat(filePath));
if (stat.fileType == ox::FileType::Directory) {
const auto dir = ox::sfmt("{}{}/", path, name);
oxReturnError(preloadDir(ts, romFs, pl, dir));