MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / getDownloadAction

Method getDownloadAction

launcher/minecraft/AssetsUtils.cpp:309–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309NetAction::Ptr AssetObject::getDownloadAction()
310{
311 QFileInfo objectFile(getLocalPath());
312 if ((!objectFile.isFile()) || (objectFile.size() != size))
313 {
314 auto objectDL = Net::Download::makeFile(getUrl(), objectFile.filePath());
315 if(hash.size())
316 {
317 auto rawHash = QByteArray::fromHex(hash.toLatin1());
318 objectDL->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawHash));
319 }
320 objectDL->setProgress(objectDL->getProgress(), size);
321 return objectDL;
322 }
323 return nullptr;
324}
325
326QString AssetObject::getLocalPath()
327{

Callers 1

getDownloadJobMethod · 0.80

Calls 5

filePathMethod · 0.80
setProgressMethod · 0.80
getProgressMethod · 0.80
sizeMethod · 0.45
addValidatorMethod · 0.45

Tested by

no test coverage detected