GH-2026 fix native library downloads
If a single library had both native and java jars, they would randomly get confused.
This commit is contained in:
parent
ab870648bd
commit
3eebc641f9
@ -104,6 +104,7 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class
|
|||||||
}
|
}
|
||||||
if (isForge)
|
if (isForge)
|
||||||
{
|
{
|
||||||
|
qDebug() << "XzDownload for:" << rawName() << "storage:" << storage << "url:" << url;
|
||||||
out.append(ForgeXzDownload::make(storage, entry));
|
out.append(ForgeXzDownload::make(storage, entry));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -113,11 +114,14 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class
|
|||||||
auto rawSha1 = QByteArray::fromHex(sha1.toLatin1());
|
auto rawSha1 = QByteArray::fromHex(sha1.toLatin1());
|
||||||
auto dl = Net::Download::makeCached(url, entry, options);
|
auto dl = Net::Download::makeCached(url, entry, options);
|
||||||
dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawSha1));
|
dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawSha1));
|
||||||
|
qDebug() << "Checksummed Download for:" << rawName() << "storage:" << storage << "url:" << url;
|
||||||
out.append(dl);
|
out.append(dl);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
out.append(Net::Download::makeCached(url, entry, options));
|
out.append(Net::Download::makeCached(url, entry, options));
|
||||||
|
qDebug() << "Download for:" << rawName() << "storage:" << storage << "url:" << url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -125,42 +129,56 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class
|
|||||||
QString raw_storage = storageSuffix(system);
|
QString raw_storage = storageSuffix(system);
|
||||||
if(m_mojangDownloads)
|
if(m_mojangDownloads)
|
||||||
{
|
{
|
||||||
if(m_mojangDownloads->artifact)
|
if(isNative())
|
||||||
{
|
{
|
||||||
auto artifact = m_mojangDownloads->artifact;
|
if(m_nativeClassifiers.contains(system))
|
||||||
add_download(raw_storage, artifact->url, artifact->sha1);
|
|
||||||
}
|
|
||||||
if(m_nativeClassifiers.contains(system))
|
|
||||||
{
|
|
||||||
auto nativeClassifier = m_nativeClassifiers[system];
|
|
||||||
if(nativeClassifier.contains("${arch}"))
|
|
||||||
{
|
{
|
||||||
auto nat32Classifier = nativeClassifier;
|
auto nativeClassifier = m_nativeClassifiers[system];
|
||||||
nat32Classifier.replace("${arch}", "32");
|
if(nativeClassifier.contains("${arch}"))
|
||||||
auto nat64Classifier = nativeClassifier;
|
|
||||||
nat64Classifier.replace("${arch}", "64");
|
|
||||||
auto nat32info = m_mojangDownloads->getDownloadInfo(nat32Classifier);
|
|
||||||
if(nat32info)
|
|
||||||
{
|
{
|
||||||
auto cooked_storage = raw_storage;
|
auto nat32Classifier = nativeClassifier;
|
||||||
cooked_storage.replace("${arch}", "32");
|
nat32Classifier.replace("${arch}", "32");
|
||||||
add_download(cooked_storage, nat32info->url, nat32info->sha1);
|
auto nat64Classifier = nativeClassifier;
|
||||||
|
nat64Classifier.replace("${arch}", "64");
|
||||||
|
auto nat32info = m_mojangDownloads->getDownloadInfo(nat32Classifier);
|
||||||
|
if(nat32info)
|
||||||
|
{
|
||||||
|
auto cooked_storage = raw_storage;
|
||||||
|
cooked_storage.replace("${arch}", "32");
|
||||||
|
add_download(cooked_storage, nat32info->url, nat32info->sha1);
|
||||||
|
}
|
||||||
|
auto nat64info = m_mojangDownloads->getDownloadInfo(nat64Classifier);
|
||||||
|
if(nat64info)
|
||||||
|
{
|
||||||
|
auto cooked_storage = raw_storage;
|
||||||
|
cooked_storage.replace("${arch}", "64");
|
||||||
|
add_download(cooked_storage, nat64info->url, nat64info->sha1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
auto nat64info = m_mojangDownloads->getDownloadInfo(nat64Classifier);
|
else
|
||||||
if(nat64info)
|
|
||||||
{
|
{
|
||||||
auto cooked_storage = raw_storage;
|
auto info = m_mojangDownloads->getDownloadInfo(nativeClassifier);
|
||||||
cooked_storage.replace("${arch}", "64");
|
if(info)
|
||||||
add_download(cooked_storage, nat64info->url, nat64info->sha1);
|
{
|
||||||
|
add_download(raw_storage, info->url, info->sha1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto info = m_mojangDownloads->getDownloadInfo(nativeClassifier);
|
qDebug() << "Ignoring native library" << m_name << "because it has no classifier for current OS";
|
||||||
if(info)
|
}
|
||||||
{
|
}
|
||||||
add_download(raw_storage, info->url, info->sha1);
|
else
|
||||||
}
|
{
|
||||||
|
if(m_mojangDownloads->artifact)
|
||||||
|
{
|
||||||
|
auto artifact = m_mojangDownloads->artifact;
|
||||||
|
add_download(raw_storage, artifact->url, artifact->sha1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "Ignoring java library" << m_name << "because it has no artifact";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user