[nostalgia/studio] Update for new model type store system
This commit is contained in:
parent
885f4a8713
commit
717bbd2e0f
@ -103,15 +103,22 @@ ox::Error Project::writeObj(const ox::String &path, auto *obj) const noexcept {
|
|||||||
// write to FS
|
// write to FS
|
||||||
oxReturnError(writeBuff(path, buff));
|
oxReturnError(writeBuff(path, buff));
|
||||||
// write type descriptor
|
// write type descriptor
|
||||||
oxRequire(type, ox::buildTypeDef(obj));
|
ox::TypeStore typeStore;
|
||||||
oxRequireM(typeOut, ox::writeClaw(type.get(), ox::ClawFormat::Organic));
|
oxReturnError(ox::buildTypeDef(&typeStore, obj));
|
||||||
// replace garbage last character with new line
|
// write out type store
|
||||||
typeOut.back().value = '\n';
|
|
||||||
// write to FS
|
|
||||||
static constexpr auto descPath = "/.nostalgia/type_descriptors";
|
static constexpr auto descPath = "/.nostalgia/type_descriptors";
|
||||||
const auto typePath = ox::sfmt("{}/{}", descPath, type->typeName);
|
|
||||||
oxReturnError(mkdir(descPath));
|
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);
|
fileUpdated.emit(path);
|
||||||
return OxError(0);
|
return OxError(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user