Changeset View
Changeset View
Standalone View
Standalone View
kerfuffle/pluginmanager.cpp
Show First 20 Lines • Show All 263 Lines • ▼ Show 20 Line(s) | 262 | foreach (const QString &path, QCoreApplication::libraryPaths()) { | |||
---|---|---|---|---|---|
264 | if (QFileInfo::exists(pluginPath)) { | 264 | if (QFileInfo::exists(pluginPath)) { | ||
265 | return pluginPath; | 265 | return pluginPath; | ||
266 | } | 266 | } | ||
267 | } | 267 | } | ||
268 | 268 | | |||
269 | return QString(); | 269 | return QString(); | ||
270 | }(); | 270 | }(); | ||
271 | 271 | | |||
272 | // Step 2: ldd the libarchive plugin to figure out the absolute libarchive path. | 272 | // Step 2: process the libarchive plugin dependencies to figure out the absolute libarchive path. | ||
273 | QProcess ldd; | 273 | QProcess dependencyTool; | ||
274 | ldd.start(QStringLiteral("ldd"), {pluginPath}); | 274 | QStringList args = {QStringLiteral(DEPENDENCY_TOOL_ARGS)}; | ||
elvisangelaccio: Missing `const` here. | |||||
275 | ldd.waitForFinished(); | 275 | dependencyTool.setProgram(QStringLiteral(DEPENDENCY_TOOL)); | ||
276 | const QString output = QString::fromUtf8(ldd.readAllStandardOutput()); | 276 | dependencyTool.setArguments(args + QStringList(pluginPath)); | ||
277 | QRegularExpression regex(QStringLiteral("/.*/libarchive.so")); | 277 | dependencyTool.start(); | ||
278 | dependencyTool.waitForFinished(); | ||||
279 | const QString output = QString::fromUtf8(dependencyTool.readAllStandardOutput()); | ||||
280 | QRegularExpression regex(QStringLiteral("/.*/libarchive.so|/.*/libarchive.*.dylib")); | ||||
278 | if (!regex.match(output).hasMatch()) { | 281 | if (!regex.match(output).hasMatch()) { | ||
279 | return false; | 282 | return false; | ||
280 | } | 283 | } | ||
281 | 284 | | |||
282 | // Step 3: check whether libarchive links against liblzo. | 285 | // Step 3: check whether libarchive links against liblzo. | ||
283 | const QString libarchivePath = regex.match(output).captured(0); | 286 | const QStringList libarchivePath(regex.match(output).captured(0)); | ||
284 | ldd.start(QStringLiteral("ldd"), {libarchivePath}); | 287 | dependencyTool.setArguments(args + libarchivePath); | ||
285 | ldd.waitForFinished(); | 288 | dependencyTool.start(); | ||
286 | return ldd.readAllStandardOutput().contains(QByteArrayLiteral("lzo")); | 289 | dependencyTool.waitForFinished(); | ||
290 | return dependencyTool.readAllStandardOutput().contains(QByteArrayLiteral("lzo")); | ||||
287 | } | 291 | } | ||
288 | 292 | | |||
289 | } | 293 | } |
Missing const here.