1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-21 20:27:45 +00:00

Stop AssetUpdater from crashing under certain scenarios

This commit is contained in:
Joshua Goins 2023-10-11 12:59:15 -04:00
parent 2d7538bae1
commit fd19641e72

View file

@ -85,6 +85,8 @@ QCoro::Task<bool> AssetUpdater::checkRemoteDalamudAssetVersion()
co_return co_await installDalamudAssets(); co_return co_await installDalamudAssets();
} }
co_return true;
} }
QCoro::Task<bool> AssetUpdater::checkRemoteDalamudVersion() QCoro::Task<bool> AssetUpdater::checkRemoteDalamudVersion()
@ -189,13 +191,13 @@ QCoro::Task<bool> AssetUpdater::installDalamud()
qInfo(ASTRA_LOG) << "Finished downloading Dalamud"; qInfo(ASTRA_LOG) << "Finished downloading Dalamud";
QFile file(tempDir.path() + QStringLiteral("/latest.zip")); QFile file(tempDir.filePath(QStringLiteral("/latest.zip")));
file.open(QIODevice::WriteOnly); file.open(QIODevice::WriteOnly);
file.write(reply->readAll()); file.write(reply->readAll());
file.close(); file.close();
const bool success = const bool success =
!JlCompress::extractDir(tempDir.path() + QLatin1String("/latest.zip"), dalamudDir.absoluteFilePath(m_profile.dalamudChannelName())).empty(); !JlCompress::extractDir(tempDir.filePath(QStringLiteral("latest.zip")), dalamudDir.absoluteFilePath(m_profile.dalamudChannelName())).empty();
if (!success) { if (!success) {
qCritical(ASTRA_LOG) << "Failed to install Dalamud"; qCritical(ASTRA_LOG) << "Failed to install Dalamud";
@ -222,7 +224,7 @@ QCoro::Task<bool> AssetUpdater::installRuntime()
qInfo(ASTRA_LOG) << "Finished downloading Dotnet-core"; qInfo(ASTRA_LOG) << "Finished downloading Dotnet-core";
QFile file(tempDir.path() + QStringLiteral("/dotnet-core.zip")); QFile file(tempDir.filePath(QStringLiteral("dotnet-core.zip")));
file.open(QIODevice::WriteOnly); file.open(QIODevice::WriteOnly);
file.write(reply->readAll()); file.write(reply->readAll());
file.close(); file.close();
@ -238,14 +240,14 @@ QCoro::Task<bool> AssetUpdater::installRuntime()
qInfo(ASTRA_LOG) << "Finished downloading Dotnet-desktop"; qInfo(ASTRA_LOG) << "Finished downloading Dotnet-desktop";
QFile file(tempDir.path() + QStringLiteral("/dotnet-desktop.zip")); QFile file(tempDir.filePath(QStringLiteral("dotnet-desktop.zip")));
file.open(QIODevice::WriteOnly); file.open(QIODevice::WriteOnly);
file.write(reply->readAll()); file.write(reply->readAll());
file.close(); file.close();
} }
bool success = !JlCompress::extractDir(tempDir.path() + QStringLiteral("/dotnet-core.zip"), dalamudRuntimeDir.absolutePath()).empty(); bool success = !JlCompress::extractDir(tempDir.filePath(QStringLiteral("dotnet-core.zip")), dalamudRuntimeDir.absolutePath()).empty();
success |= !JlCompress::extractDir(tempDir.path() + QStringLiteral("/dotnet-desktop.zip"), dalamudRuntimeDir.absolutePath()).empty(); success |= !JlCompress::extractDir(tempDir.filePath(QStringLiteral("dotnet-desktop.zip")), dalamudRuntimeDir.absolutePath()).empty();
if (!success) { if (!success) {
qCritical(ASTRA_LOG) << "Failed to install dotnet"; qCritical(ASTRA_LOG) << "Failed to install dotnet";