[nostalgia/tools/pack] Fix for a non-compliant implementation of fstream

This commit is contained in:
Gary Talent 2023-01-03 03:33:54 -06:00
parent 497bbc1a17
commit cf6c05f4c6

View File

@ -15,7 +15,7 @@ using namespace nostalgia;
static ox::Error writeFileBuff(ox::CRStringView path, const ox::Buffer &buff) noexcept {
try {
std::ofstream f(toStdStringView(path), std::ios::binary);
std::ofstream f(std::string(toStdStringView(path)), std::ios::binary);
f.write(buff.data(), static_cast<intptr_t>(buff.size()));
} catch (const std::fstream::failure&) {
return OxError(2, "failed to write file");
@ -24,7 +24,7 @@ static ox::Error writeFileBuff(ox::CRStringView path, const ox::Buffer &buff) no
}
static ox::Result<ox::Buffer> readFileBuff(ox::CRStringView path) noexcept {
std::ifstream file(toStdStringView(path), std::ios::binary | std::ios::ate);
std::ifstream file(std::string(toStdStringView(path)), std::ios::binary | std::ios::ate);
if (!file.good()) {
oxErrorf("Could not find OxFS file: {}", path);
return OxError(1, "Could not find OxFS file");