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()
|
void PluginManager::downloadPlugins()
|
||||||
{
|
{
|
||||||
if (m_DataDownloader.isFinished()) {
|
if (m_DataDownloader.isFinished()) {
|
||||||
savePlugin();
|
if (!savePlugin()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_DownloadIndex != m_PluginList.size() - 1) {
|
if (m_DownloadIndex != m_PluginList.size() - 1) {
|
||||||
emit downloadNext();
|
emit downloadNext();
|
||||||
}
|
}
|
||||||
|
@ -173,7 +176,7 @@ void PluginManager::generateCertificate()
|
||||||
downloadOpenSslSetup();
|
downloadOpenSslSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginManager::savePlugin()
|
bool PluginManager::savePlugin()
|
||||||
{
|
{
|
||||||
// create the path if not exist
|
// create the path if not exist
|
||||||
QDir dir(m_PluginDir);
|
QDir dir(m_PluginDir);
|
||||||
|
@ -189,15 +192,19 @@ void PluginManager::savePlugin()
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if (!file.open(QIODevice::WriteOnly)) {
|
if (!file.open(QIODevice::WriteOnly)) {
|
||||||
emit error(
|
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_PluginList.at(m_DownloadIndex))
|
||||||
.arg(m_PluginDir));
|
.arg(m_PluginDir)
|
||||||
|
.arg(file.errorString()));
|
||||||
|
|
||||||
return;
|
file.close();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
file.write(m_DataDownloader.data());
|
file.write(m_DataDownloader.data());
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PluginManager::getPluginUrl(const QString& pluginName)
|
QString PluginManager::getPluginUrl(const QString& pluginName)
|
||||||
|
|
|
@ -44,7 +44,7 @@ public slots:
|
||||||
void doGenerateCertificate();
|
void doGenerateCertificate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void savePlugin();
|
bool savePlugin();
|
||||||
QString getPluginUrl(const QString& pluginName);
|
QString getPluginUrl(const QString& pluginName);
|
||||||
QString getOpenSslSetupUrl();
|
QString getOpenSslSetupUrl();
|
||||||
bool checkOpenSslBinary();
|
bool checkOpenSslBinary();
|
||||||
|
|
Loading…
Reference in New Issue