NOISSUE continue refactoring things to make tests pass

This commit is contained in:
Petr Mrázek
2021-11-21 23:21:12 +01:00
parent c2c56a2f6c
commit 69213b1206
103 changed files with 634 additions and 773 deletions

View File

@ -1,14 +1,16 @@
#include <meta/VersionList.h>
#include <meta/Index.h>
#include <Env.h>
#include "Component.h"
#include <QSaveFile>
#include "meta/Version.h"
#include "VersionFile.h"
#include "minecraft/PackProfile.h"
#include <FileSystem.h>
#include <QSaveFile>
#include "FileSystem.h"
#include "OneSixVersionFormat.h"
#include "Application.h"
#include <assert.h>
Component::Component(PackProfile * parent, const QString& uid)
@ -85,9 +87,9 @@ std::shared_ptr<class VersionFile> Component::getVersionFile() const
std::shared_ptr<class Meta::VersionList> Component::getVersionList() const
{
// FIXME: what if the metadata index isn't loaded yet?
if(ENV->metadataIndex()->hasUid(m_uid))
if(APPLICATION->metadataIndex()->hasUid(m_uid))
{
return ENV->metadataIndex()->get(m_uid);
return APPLICATION->metadataIndex()->get(m_uid);
}
return nullptr;
}
@ -192,7 +194,7 @@ bool Component::isRevertible()
{
if (isCustom())
{
if(ENV->metadataIndex()->hasUid(m_uid))
if(APPLICATION->metadataIndex()->hasUid(m_uid))
{
return true;
}
@ -266,7 +268,7 @@ void Component::setVersion(const QString& version)
// we don't have a file, therefore we are loaded with metadata
m_cachedVersion = version;
// see if the meta version is loaded
auto metaVersion = ENV->metadataIndex()->get(m_uid, version);
auto metaVersion = APPLICATION->metadataIndex()->get(m_uid, version);
if(metaVersion->isLoaded())
{
// if yes, we can continue with that.
@ -350,7 +352,7 @@ bool Component::revert()
m_file.reset();
// check local cache for metadata...
auto version = ENV->metadataIndex()->get(m_uid, m_version);
auto version = APPLICATION->metadataIndex()->get(m_uid, m_version);
if(version->isLoaded())
{
m_metaVersion = version;