Fixed #4537 by add file error checking
This commit is contained in:
parent
cf6a6bcd48
commit
5e2b8a5048
|
@ -94,7 +94,10 @@ bool PluginManager::exist(QString name)
|
|||
void PluginManager::downloadPlugins()
|
||||
{
|
||||
if (m_DataDownloader.isFinished()) {
|
||||
savePlugin();
|
||||
if (!savePlugin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_DownloadIndex != m_PluginList.size() - 1) {
|
||||
emit downloadNext();
|
||||
}
|
||||
|
@ -173,7 +176,7 @@ void PluginManager::generateCertificate()
|
|||
downloadOpenSslSetup();
|
||||
}
|
||||
|
||||
void PluginManager::savePlugin()
|
||||
bool PluginManager::savePlugin()
|
||||
{
|
||||
// create the path if not exist
|
||||
QDir dir(m_PluginDir);
|
||||
|
@ -189,15 +192,19 @@ void PluginManager::savePlugin()
|
|||
QFile file(filename);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
emit error(
|
||||
tr("Failed to download '%1' plugin to: %2")
|
||||
tr("Failed to download plugin '%1' to: %2 \n %3")
|
||||
.arg(m_PluginList.at(m_DownloadIndex))
|
||||
.arg(m_PluginDir));
|
||||
.arg(m_PluginDir)
|
||||
.arg(file.errorString()));
|
||||
|
||||
return;
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
file.write(m_DataDownloader.data());
|
||||
file.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString PluginManager::getPluginUrl(const QString& pluginName)
|
||||
|
|
|
@ -44,7 +44,7 @@ public slots:
|
|||
void doGenerateCertificate();
|
||||
|
||||
private:
|
||||
void savePlugin();
|
||||
bool savePlugin();
|
||||
QString getPluginUrl(const QString& pluginName);
|
||||
QString getOpenSslSetupUrl();
|
||||
bool checkOpenSslBinary();
|
||||
|
|
Loading…
Reference in New Issue