diff --git a/src/nostalgia/studio/lib/project.cpp b/src/nostalgia/studio/lib/project.cpp index 66bc7cfe..7bd320b3 100644 --- a/src/nostalgia/studio/lib/project.cpp +++ b/src/nostalgia/studio/lib/project.cpp @@ -18,7 +18,7 @@ ox::String filePathToName(const ox::String &path, const ox::String &prefix, cons } -Project::Project(ox::FileSystem *fs, const ox::String &path) noexcept: m_fs(fs) { +Project::Project(ox::FileSystem *fs, const ox::String &path) noexcept: m_typeStore(fs), m_fs(fs) { oxTracef("nostalgia::studio", "Project: {}", path); m_path = path; buildFileIndex(); diff --git a/src/nostalgia/studio/lib/project.hpp b/src/nostalgia/studio/lib/project.hpp index 4318ee37..0a041ff6 100644 --- a/src/nostalgia/studio/lib/project.hpp +++ b/src/nostalgia/studio/lib/project.hpp @@ -12,6 +12,8 @@ #include #include +#include + #include "nostalgiastudio_export.h" namespace nostalgia::studio { @@ -40,7 +42,8 @@ ox::String filePathToName(const ox::String &path, const ox::String &prefix, cons class NOSTALGIASTUDIO_EXPORT Project { private: - ox::String m_path = ""; + ox::String m_path; + mutable core::TypeStore m_typeStore; mutable ox::FileSystem *m_fs = nullptr; ox::HashMap> m_fileExtFileMap; @@ -103,12 +106,11 @@ ox::Error Project::writeObj(const ox::String &path, auto *obj) const noexcept { // write to FS oxReturnError(writeBuff(path, buff)); // write type descriptor - ox::TypeStore typeStore; - oxReturnError(ox::buildTypeDef(&typeStore, obj)); + oxReturnError(ox::buildTypeDef(&m_typeStore, obj)); // write out type store static constexpr auto descPath = "/.nostalgia/type_descriptors"; oxReturnError(mkdir(descPath)); - for (const auto t : typeStore.typeList()) { + for (const auto t : m_typeStore.typeList()) { if (t->typeName.beginsWith("B:")) { continue; }