Handle errors when opening QFile

This commit is contained in:
Guillaume Meunier
2025-10-26 12:25:13 +01:00
parent 93bf067139
commit c7b94b6524
+7 -1
View File
@@ -131,7 +131,13 @@ QCoro::Task<> apk_installer::doInstallApk(QString serial)
auto apk_dir = std::filesystem::path(m_apkFile.fileName().toStdString()).parent_path();
std::filesystem::create_directories(apk_dir);
m_apkFile.open(QIODeviceBase::WriteOnly | QIODeviceBase::Truncate);
if (not m_apkFile.open(QIODeviceBase::WriteOnly | QIODeviceBase::Truncate))
{
qDebug() << "Cannot save APK file " << m_apkFile.fileName() << ": " << m_apkFile.errorString();
installStatusChanged(m_installStatus = i18n("Cannot save APK file: %1", m_apkFile.errorString()));
busyChanged(m_busy = false);
co_return;
}
qDebug() << "Downloading from" << m_apkUrl.toString() << "to" << m_apkFile.fileName();