From 717bbd2e0f158539bac509c563ffffae689c3aa5 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 28 May 2022 20:00:28 -0500 Subject: [PATCH] [nostalgia/studio] Update for new model type store system --- src/nostalgia/studio/lib/project.hpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/nostalgia/studio/lib/project.hpp b/src/nostalgia/studio/lib/project.hpp index e65d095a..4318ee37 100644 --- a/src/nostalgia/studio/lib/project.hpp +++ b/src/nostalgia/studio/lib/project.hpp @@ -103,15 +103,22 @@ ox::Error Project::writeObj(const ox::String &path, auto *obj) const noexcept { // write to FS oxReturnError(writeBuff(path, buff)); // write type descriptor - oxRequire(type, ox::buildTypeDef(obj)); - oxRequireM(typeOut, ox::writeClaw(type.get(), ox::ClawFormat::Organic)); - // replace garbage last character with new line - typeOut.back().value = '\n'; - // write to FS + ox::TypeStore typeStore; + oxReturnError(ox::buildTypeDef(&typeStore, obj)); + // write out type store static constexpr auto descPath = "/.nostalgia/type_descriptors"; - const auto typePath = ox::sfmt("{}/{}", descPath, type->typeName); oxReturnError(mkdir(descPath)); - oxReturnError(writeBuff(typePath, typeOut)); + for (const auto t : typeStore.typeList()) { + if (t->typeName.beginsWith("B:")) { + continue; + } + oxRequireM(typeOut, ox::writeClaw(t, ox::ClawFormat::Organic)); + // replace garbage last character with new line + typeOut.back().value = '\n'; + // write to FS + const auto typePath = ox::sfmt("{}/{}", descPath, t->typeName); + oxReturnError(writeBuff(typePath, typeOut)); + } fileUpdated.emit(path); return OxError(0); }