diff --git a/src/olympic/keel/src/pack-applib.cpp b/src/olympic/keel/src/pack-applib.cpp index 5ca13c88..a486f890 100644 --- a/src/olympic/keel/src/pack-applib.cpp +++ b/src/olympic/keel/src/pack-applib.cpp @@ -76,8 +76,8 @@ static ox::Error pack( oxReturnError(appendBinary(romBuff, dstBuff, *pl)); oxOutf("Final ROM buff size: {} bytes\n", romBuff.size()); oxReturnError(writeFileBuff(argRomBin, romBuff)); - oxRequire(manifestJson, ox::writeOC(manifest)); - oxReturnError(writeFileBuff(argManifest, manifestJson)); + oxRequire(manifestJson, ox::writeOC(manifest)); + oxReturnError(writeFileBuff(argManifest, {manifestJson.data(), manifestJson.len()})); return {}; } diff --git a/src/olympic/studio/modlib/include/studio/project.hpp b/src/olympic/studio/modlib/include/studio/project.hpp index 223fc099..d363c0bc 100644 --- a/src/olympic/studio/modlib/include/studio/project.hpp +++ b/src/olympic/studio/modlib/include/studio/project.hpp @@ -107,7 +107,7 @@ class Project { void indexFile(ox::CRStringView path) noexcept; - ox::Error writeBuff(ox::CRStringView path, ox::Buffer const&buff) noexcept; + ox::Error writeBuff(ox::CRStringView path, ox::BufferView const&buff) noexcept; ox::Result loadBuff(ox::CRStringView path) const noexcept; diff --git a/src/olympic/studio/modlib/src/project.cpp b/src/olympic/studio/modlib/src/project.cpp index 9b9843a8..9e0e06e5 100644 --- a/src/olympic/studio/modlib/src/project.cpp +++ b/src/olympic/studio/modlib/src/project.cpp @@ -81,12 +81,10 @@ ox::Error Project::writeTypeStore() noexcept { // write all descriptors because we don't know which types T depends on oxReturnError(mkdir(m_typeDescPath)); for (auto const &t: m_typeStore.typeList()) { - oxRequireM(typeOut, ox::writeClaw(*t, ox::ClawFormat::Organic)); - // replace garbage last character with new line - *typeOut.back().value = '\n'; + oxRequire(typeOut, ox::writeClaw(*t, ox::ClawFormat::Organic)); // write to FS auto const typePath = ox::sfmt("{}/{}", m_typeDescPath, buildTypeId(*t)); - oxReturnError(writeBuff(typePath, typeOut)); + oxReturnError(writeBuff(typePath, {typeOut.data(), typeOut.size() - 1})); } return {}; } @@ -114,7 +112,7 @@ void Project::indexFile(ox::CRStringView path) noexcept { m_fileExtFileMap[ext].emplace_back(path); } -ox::Error Project::writeBuff(ox::CRStringView path, ox::Buffer const&buff) noexcept { +ox::Error Project::writeBuff(ox::CRStringView path, ox::BufferView const&buff) noexcept { constexpr auto HdrSz = 40; ox::Buffer outBuff; outBuff.reserve(buff.size() + HdrSz);