From 86202562fe2fde9181815f0f65be21183943f69d Mon Sep 17 00:00:00 2001 From: Gary Talent <gary@drinkingtea.net> Date: Fri, 16 Apr 2021 19:56:36 -0500 Subject: [PATCH] [nostalgia/tools/pack] Update for new FS error handling --- src/nostalgia/tools/pack.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/nostalgia/tools/pack.cpp b/src/nostalgia/tools/pack.cpp index 5f44dd45..0b24f24d 100644 --- a/src/nostalgia/tools/pack.cpp +++ b/src/nostalgia/tools/pack.cpp @@ -15,7 +15,7 @@ #include "pack/pack.hpp" -static ox::Error writeFileBuff(const std::string &path, std::vector<char> &buff) { +static ox::Error writeFileBuff(const std::string_view path, ox::Vector<char> &buff) { try { std::ofstream f(path, std::ios::binary); f.write(buff.data(), static_cast<intptr_t>(buff.size())); @@ -36,15 +36,16 @@ static ox::Error run(const ox::ClArgs &args) { std::cerr << "error: must specify a destination ROM file\n"; return OxError(1, "must specify a destination ROM file"); } - std::vector<char> buff(32 * ox::units::MB); + ox::Vector<char> buff(32 * ox::units::MB); oxReturnError(ox::FileSystem32::format(buff.data(), buff.size())); ox::PassThroughFS src(argSrc.c_str()); ox::FileSystem32 dst(ox::FileStore32(buff.data(), buff.size())); oxReturnError(nostalgia::pack(&src, &dst)); oxReturnError(dst.resize()); - std::cout << "new size: " << dst.size() << '\n'; - buff.resize(dst.size()); + oxRequire(dstSize, dst.size()); + std::cout << "new size: " << dstSize << '\n'; + buff.resize(dstSize); oxReturnError(writeFileBuff(argDst.c_str(), buff)); return OxError(0);