Commit 717c4b0f authored by Albert Astals Cid's avatar Albert Astals Cid

Fix unrar detection for versions that don't support --version

Based on patches by Yuri Chornoivan and Jörg Schuck

BUGS: 340323
FIXED-IN: 4.14.3
parent c40419e9
......@@ -39,11 +39,11 @@ struct UnrarHelper
K_GLOBAL_STATIC( UnrarHelper, helper )
static UnrarFlavour* detectUnrar( const QString &unrarPath )
static UnrarFlavour* detectUnrar( const QString &unrarPath, const QString &versionCommand )
{
UnrarFlavour* kind = 0;
QProcess proc;
proc.start( unrarPath, QStringList() << "--version" );
proc.start( unrarPath, QStringList() << versionCommand );
bool ok = proc.waitForFinished( -1 );
Q_UNUSED( ok )
const QStringList lines = QString::fromLocal8Bit( proc.readAllStandardOutput() ).split( '\n', QString::SkipEmptyParts );
......@@ -69,7 +69,10 @@ UnrarHelper::UnrarHelper()
path = KStandardDirs::findExe( "rar" );
if ( !path.isEmpty() )
kind = detectUnrar( path );
kind = detectUnrar( path, "--version" );
if ( !kind )
kind = detectUnrar( path, "-v" );
if ( !kind )
{
......
Markdown is supported
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