[nostalgia/studio] Make Project write out type data with data

This commit is contained in:
Gary Talent 2020-06-16 04:42:18 -05:00
parent 17762b40b7
commit df96407669
3 changed files with 12 additions and 1 deletions

View File

@ -16,8 +16,9 @@
#include <ox/mc/mc.hpp>
#include <qnamespace.h>
#include "ox/claw/claw.hpp"
#include <ox/claw/claw.hpp>
#include <ox/fs/filesystem/passthroughfs.hpp>
#include <ox/model/descwrite.hpp>
#include "nostalgiastudio_export.h"
@ -98,6 +99,16 @@ void Project::writeObj(QString path, T *obj) const {
oxThrowError(err);
// write to FS
writeBuff(path, ox::bit_cast<uint8_t*>(buff.data()), buff.size());
// write type descriptor
const auto type = ox::buildTypeDef(obj);
const auto typeOut = ox::writeClaw(type.value, ox::ClawFormat::Organic);
oxThrowError(typeOut);
// write to FS
QString descPath = "/.nostalgia/type_descriptors/";
const auto typePath = descPath + type.value->typeName.c_str();
mkdir(descPath);
writeBuff(typePath, ox::bit_cast<uint8_t*>(typeOut.value.data()), typeOut.value.size());
emit fileUpdated(path);
}