NOISSUE stop using the path attributes from Mojang download info

It really should not dictate how are things stored and it just makes
the metadata bigger for no reason.
This commit is contained in:
Petr Mrázek 2017-04-15 11:40:22 +02:00
parent 07cde802e4
commit fc28aacdea
2 changed files with 26 additions and 61 deletions

View File

@ -74,7 +74,7 @@ Meta::BaseEntity::~BaseEntity()
QUrl Meta::BaseEntity::url() const QUrl Meta::BaseEntity::url() const
{ {
return QUrl("https://meta.multimc.org").resolved(localFilename()); return QUrl("https://meta-dev.multimc.org").resolved(localFilename());
} }
bool Meta::BaseEntity::loadLocalFile() bool Meta::BaseEntity::loadLocalFile()

View File

@ -28,48 +28,6 @@ void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& na
} }
return out.absoluteFilePath(); return out.absoluteFilePath();
}; };
if(m_mojangDownloads)
{
if(!isNative())
{
if(m_mojangDownloads->artifact)
{
auto artifact = m_mojangDownloads->artifact;
jar += actualPath(artifact->path);
}
}
else if(m_nativeClassifiers.contains(system))
{
auto nativeClassifier = m_nativeClassifiers[system];
if(nativeClassifier.contains("${arch}"))
{
auto nat32Classifier = nativeClassifier;
nat32Classifier.replace("${arch}", "32");
auto nat64Classifier = nativeClassifier;
nat64Classifier.replace("${arch}", "64");
auto nat32info = m_mojangDownloads->getDownloadInfo(nat32Classifier);
if(nat32info)
native32 += actualPath(nat32info->path);
auto nat64info = m_mojangDownloads->getDownloadInfo(nat64Classifier);
if(nat64info)
native64 += actualPath(nat64info->path);
}
else
{
auto dlinfo = m_mojangDownloads->getDownloadInfo(nativeClassifier);
if(!dlinfo)
{
qWarning() << "Cannot get native for" << nativeClassifier << "while processing" << m_name;
}
else
{
native += actualPath(dlinfo->path);
}
}
}
}
else
{
QString raw_storage = storageSuffix(system); QString raw_storage = storageSuffix(system);
if(isNative()) if(isNative())
{ {
@ -91,7 +49,6 @@ void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& na
{ {
jar += actualPath(raw_storage); jar += actualPath(raw_storage);
} }
}
} }
QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class HttpMetaCache* cache, QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class HttpMetaCache* cache,
@ -165,12 +122,13 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class
return true; return true;
}; };
QString raw_storage = storageSuffix(system);
if(m_mojangDownloads) if(m_mojangDownloads)
{ {
if(m_mojangDownloads->artifact) if(m_mojangDownloads->artifact)
{ {
auto artifact = m_mojangDownloads->artifact; auto artifact = m_mojangDownloads->artifact;
add_download(artifact->path, artifact->url, artifact->sha1); add_download(raw_storage, artifact->url, artifact->sha1);
} }
if(m_nativeClassifiers.contains(system)) if(m_nativeClassifiers.contains(system))
{ {
@ -183,24 +141,31 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class
nat64Classifier.replace("${arch}", "64"); nat64Classifier.replace("${arch}", "64");
auto nat32info = m_mojangDownloads->getDownloadInfo(nat32Classifier); auto nat32info = m_mojangDownloads->getDownloadInfo(nat32Classifier);
if(nat32info) if(nat32info)
add_download(nat32info->path, nat32info->url, nat32info->sha1); {
auto cooked_storage = raw_storage;
cooked_storage.replace("${arch}", "32");
add_download(cooked_storage, nat32info->url, nat32info->sha1);
}
auto nat64info = m_mojangDownloads->getDownloadInfo(nat64Classifier); auto nat64info = m_mojangDownloads->getDownloadInfo(nat64Classifier);
if(nat64info) if(nat64info)
add_download(nat64info->path, nat64info->url, nat64info->sha1); {
auto cooked_storage = raw_storage;
cooked_storage.replace("${arch}", "64");
add_download(cooked_storage, nat64info->url, nat64info->sha1);
}
} }
else else
{ {
auto info = m_mojangDownloads->getDownloadInfo(nativeClassifier); auto info = m_mojangDownloads->getDownloadInfo(nativeClassifier);
if(info) if(info)
{ {
add_download(info->path, info->url, info->sha1); add_download(raw_storage, info->url, info->sha1);
} }
} }
} }
} }
else else
{ {
QString raw_storage = storageSuffix(system);
auto raw_dl = [&](){ auto raw_dl = [&](){
if (!m_absoluteURL.isEmpty()) if (!m_absoluteURL.isEmpty())
{ {