[nostalgia,studio] Cleanup, simplify string handling

This commit is contained in:
2023-12-04 21:45:23 -06:00
parent 0d606643f5
commit 195fd7a113
7 changed files with 29 additions and 56 deletions

View File

@@ -39,18 +39,7 @@ studio::EditorMaker editorMaker(turbine::Context &ctx, ox::CRStringView ext) noe
return {
{ox::String(ext)},
[&ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
return ox::makeCatch<Editor>(ctx, ox::String(path));
}
};
}
template<typename Editor>
[[nodiscard]]
studio::EditorMaker editorMaker(turbine::Context *ctx, ox::Vector<ox::String> exts) noexcept {
return {
std::move(exts),
[ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
return ox::makeCatch<Editor>(ctx, ox::String(path));
return ox::makeCatch<Editor>(ctx, path);
}
};
}

View File

@@ -106,7 +106,6 @@ class Project {
template<typename T>
ox::Error Project::writeObj(ox::CRStringView path, T const&obj, ox::ClawFormat fmt) noexcept {
// write MetalClaw
oxRequireM(buff, ox::writeClaw(obj, fmt));
// write to FS
oxReturnError(writeBuff(path, buff));
@@ -117,7 +116,7 @@ ox::Error Project::writeObj(ox::CRStringView path, T const&obj, ox::ClawFormat f
// write out type store
const auto descPath = ox::sfmt("/{}/type_descriptors", m_projectDataDir);
oxReturnError(mkdir(descPath));
for (const auto &t : m_typeStore.typeList()) {
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';