Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -5488,20 +5488,25 @@ void Application::addAssetToWorldFromURLRequestFinished() { · 5487 unmodified lines | |||
| 5488 | 5488 | ||
| 5489 | if (result == ResourceRequest::Success) { | 5489 | if (result == ResourceRequest::Success) { |
| 5490 | qInfo(interfaceapp) << "Downloaded asset from" << url; | 5490 | qInfo(interfaceapp) << "Downloaded asset from" << url; |
| 5491 | |||
| 5492 | QTemporaryDir temporaryDir; | 5491 | QTemporaryDir temporaryDir; |
| 5493 | temporaryDir.setAutoRemove(false); | 5492 | temporaryDir.setAutoRemove(false); |
| 5494 | QString temporaryDirPath = temporaryDir.path(); | 5493 | if (temporaryDir.isValid()) { |
| 5495 | QString filename = url.section("filename=", 1, 1); | 5494 | QString temporaryDirPath = temporaryDir.path(); |
| 5496 | QString downloadPath = temporaryDirPath + "/" + filename; | 5495 | QString filename = url.section("filename=", 1, 1); |
| 5497 | qInfo() << "Download path:" << downloadPath; | 5496 | QString downloadPath = temporaryDirPath + "/" + filename; |
| 5498 | 5497 | qInfo() << "Download path:" << downloadPath; | |
| 5499 | QFile tempFile(downloadPath); | 5498 | |
| 5500 | if (tempFile.open(QIODevice::WriteOnly)) { | 5499 | QFile tempFile(downloadPath); |
| 5501 | tempFile.write(request->getData()); | 5500 | if (tempFile.open(QIODevice::WriteOnly)) { |
| 5502 | qApp->getFileDownloadInterface()->runUnzip(downloadPath, url, true); | 5501 | tempFile.write(request->getData()); |
| 5502 | qApp->getFileDownloadInterface()->runUnzip(downloadPath, url, true); | ||
| 5503 | } else { | ||
| 5504 | QString errorInfo = "Couldn't open temporary file for download"; | ||
| 5505 | qWarning(interfaceapp) << errorInfo; | ||
| 5506 | addAssetToWorldError(errorInfo); | ||
| 5507 | } | ||
| 5503 | } else { | 5508 | } else { |
| 5504 | QString errorInfo = "Couldn't open temporary file for writing"; | 5509 | QString errorInfo = "Couldn't create temporary directory for download"; |
| 5505 | qWarning(interfaceapp) << errorInfo; | 5510 | qWarning(interfaceapp) << errorInfo; |
| 5506 | addAssetToWorldError(errorInfo); | 5511 | addAssetToWorldError(errorInfo); |
| 5507 | } | 5512 | } |