/*
 * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
 */

#include "typestore.hpp"

namespace nostalgia::core {

ox::Result<ox::UniquePtr<ox::DescriptorType>> TypeStore::loadDescriptor(const ox::String &name, int version) noexcept {
	constexpr auto descPath = "/.nostalgia/type_descriptors";
	auto path = ox::sfmt("{}/{};{}", descPath, name, version);
	oxRequire(buff, m_fs->read(path));
	auto dt = ox::make_unique<ox::DescriptorType>();
	oxReturnError(ox::readClaw<ox::DescriptorType>(buff, dt.get()));
	return dt;
}

}