Commit c9740b70 authored by David Gow's avatar David Gow Committed by Elvis Angelaccio
Browse files

Support '7zip' as well as 'p7zip'

7zip 21.0 finally provided an official native port of 7zip, and has superseded
the p7zip port in some distros (openSUSE, for instance, no longer packages
p7zip).  The CLI interface between them is almost identical, but Ark doesn't
recognise the different version string, so doesn't work with 7zip (making it
impossible to open 7z archives in Ark on openSUSE).

Update the 7zip CLI plugin to detect both p7zip and 7zip's version lines.
parent 0990303c
Pipeline #178935 passed with stage
in 2 minutes and 49 seconds
......@@ -112,6 +112,7 @@ bool CliPlugin::readListLine(const QString& line)
}
const QRegularExpression rxVersionLine(QStringLiteral("^p7zip Version ([\\d\\.]+) .*$"));
const QRegularExpression rxVersionLine7z(QStringLiteral("^7-Zip \\(z\\) ([\\d\\.]+) .*$"));
QRegularExpressionMatch matchVersion;
switch (m_parseState) {
......@@ -121,6 +122,14 @@ bool CliPlugin::readListLine(const QString& line)
m_parseState = ParseStateHeader;
const QString p7zipVersion = matchVersion.captured(1);
qCDebug(ARK) << "p7zip version" << p7zipVersion << "detected";
break;
}
matchVersion = rxVersionLine7z.match(line);
if (matchVersion.hasMatch()) {
m_parseState = ParseStateHeader;
const QString l7zipVersion = matchVersion.captured(1);
qCDebug(ARK) << "7zip version" << l7zipVersion << "detected";
break;
}
break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment