[nostalgia/tools/pack] Fix for a non-compliant implementation of fstream
This commit is contained in:
parent
497bbc1a17
commit
cf6c05f4c6
@ -15,7 +15,7 @@ using namespace nostalgia;
|
|||||||
|
|
||||||
static ox::Error writeFileBuff(ox::CRStringView path, const ox::Buffer &buff) noexcept {
|
static ox::Error writeFileBuff(ox::CRStringView path, const ox::Buffer &buff) noexcept {
|
||||||
try {
|
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()));
|
f.write(buff.data(), static_cast<intptr_t>(buff.size()));
|
||||||
} catch (const std::fstream::failure&) {
|
} catch (const std::fstream::failure&) {
|
||||||
return OxError(2, "failed to write file");
|
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 {
|
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()) {
|
if (!file.good()) {
|
||||||
oxErrorf("Could not find OxFS file: {}", path);
|
oxErrorf("Could not find OxFS file: {}", path);
|
||||||
return OxError(1, "Could not find OxFS file");
|
return OxError(1, "Could not find OxFS file");
|
||||||
|
Loading…
Reference in New Issue
Block a user