|
|
@ -36,6 +36,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include "base/utils/fs.h" |
|
|
|
#include "base/utils/fs.h" |
|
|
|
#include "base/utils/misc.h" |
|
|
|
#include "base/utils/misc.h" |
|
|
|
|
|
|
|
#include "base/logger.h" |
|
|
|
#include "base/preferences.h" |
|
|
|
#include "base/preferences.h" |
|
|
|
#include "base/profile.h" |
|
|
|
#include "base/profile.h" |
|
|
|
#include "base/net/downloadmanager.h" |
|
|
|
#include "base/net/downloadmanager.h" |
|
|
@ -669,13 +670,20 @@ PluginVersion SearchEngine::getPluginVersion(QString filePath) |
|
|
|
if (!plugin.open(QIODevice::ReadOnly | QIODevice::Text)) |
|
|
|
if (!plugin.open(QIODevice::ReadOnly | QIODevice::Text)) |
|
|
|
return {}; |
|
|
|
return {}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const PluginVersion invalidVersion; |
|
|
|
|
|
|
|
|
|
|
|
PluginVersion version; |
|
|
|
PluginVersion version; |
|
|
|
while (!plugin.atEnd()) { |
|
|
|
while (!plugin.atEnd()) { |
|
|
|
QByteArray line = plugin.readLine(); |
|
|
|
QByteArray line = plugin.readLine(); |
|
|
|
if (line.startsWith("#VERSION: ")) { |
|
|
|
if (line.startsWith("#VERSION: ")) { |
|
|
|
line = line.split(' ').last().trimmed(); |
|
|
|
line = line.split(' ').last().trimmed(); |
|
|
|
version = PluginVersion::tryParse(line, {}); |
|
|
|
version = PluginVersion::tryParse(line, invalidVersion); |
|
|
|
qDebug() << "plugin" << filePath << "version: " << version; |
|
|
|
if (version == invalidVersion) { |
|
|
|
|
|
|
|
LogMsg(tr("Search plugin '%1' contains invalid version string ('%2')") |
|
|
|
|
|
|
|
.arg(Utils::Fs::fileName(filePath)).arg(QString::fromUtf8(line)), Log::MsgType::WARNING); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
qDebug() << "plugin" << filePath << "version: " << version; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|