refactor: introduce RuntimeContext

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2022-07-11 09:01:07 +02:00
parent 9ec1c00887
commit 09e85e948c
26 changed files with 152 additions and 169 deletions

View File

@ -10,9 +10,9 @@
#include <memory>
#include "Rule.h"
#include "minecraft/OpSys.h"
#include "GradleSpecifier.h"
#include "MojangDownloadInfo.h"
#include "RuntimeContext.h"
class Library;
class MinecraftInstance;
@ -98,7 +98,7 @@ public: /* methods */
m_repositoryURL = base_url;
}
void getApplicableFiles(OpSys system, QStringList & jar, QStringList & native,
void getApplicableFiles(const RuntimeContext & runtimeContext, QStringList & jar, QStringList & native,
QStringList & native32, QStringList & native64, const QString & overridePath) const;
void setAbsoluteUrl(const QString &absolute_url)
@ -112,7 +112,7 @@ public: /* methods */
}
/// Get the file name of the library
QString filename(OpSys system) const;
QString filename(const RuntimeContext & runtimeContext) const;
// DEPRECATED: set a display name, used by jar mods only
void setDisplayName(const QString & displayName)
@ -121,7 +121,7 @@ public: /* methods */
}
/// Get the file name of the library
QString displayName(OpSys system) const;
QString displayName(const RuntimeContext & runtimeContext) const;
void setMojangDownloadInfo(MojangLibraryDownloadInfo::Ptr info)
{
@ -140,7 +140,7 @@ public: /* methods */
}
/// Returns true if the library should be loaded (or extracted, in case of natives)
bool isActive() const;
bool isActive(const RuntimeContext & runtimeContext) const;
/// Returns true if the library is contained in an instance and false if it is shared
bool isLocal() const;
@ -152,7 +152,7 @@ public: /* methods */
bool isForge() const;
// Get a list of downloads for this library
QList<NetAction::Ptr> getDownloads(OpSys system, class HttpMetaCache * cache,
QList<NetAction::Ptr> getDownloads(const RuntimeContext & runtimeContext, class HttpMetaCache * cache,
QStringList & failedLocalFiles, const QString & overridePath) const;
private: /* methods */
@ -163,7 +163,7 @@ private: /* methods */
QString storagePrefix() const;
/// Get the relative file path where the library should be saved
QString storageSuffix(OpSys system) const;
QString storageSuffix(const RuntimeContext & runtimeContext) const;
QString hint() const
{
@ -204,7 +204,7 @@ protected: /* data */
QStringList m_extractExcludes;
/// native suffixes per OS
QMap<OpSys, QString> m_nativeClassifiers;
QMap<QString, QString> m_nativeClassifiers;
/// true if the library had a rules section (even empty)
bool applyRules = false;