[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [okular/KDE/4.11] generators/comicbook: Fix cbr (rar) listing with unrar 5
From:       Albert Astals Cid <aacid () kde ! org>
Date:       2013-10-13 21:55:16
Message-ID: E1VVTd6-0006W8-Dw () scm ! kde ! org
[Download RAW message or body]

Git commit cfa37065c26ac2a8ece558680a31be4e4bad7091 by Albert Astals Cid, on behalf \
of Christoph Feck. Committed on 13/10/2013 at 21:54.
Pushed by aacid into branch 'KDE/4.11'.

Fix cbr (rar) listing with unrar 5

The new unrar version includes the paths in its "bare listing" (unrar lb), while it \
still extracts only the filename without the path. Thus, the Unrar::list() function \
fails. This patch strips the path away.

REVIEW: 113163
BUGS: 325677
FIXED-IN: 4.11.3

M  +6    -2    generators/comicbook/unrar.cpp

http://commits.kde.org/okular/cfa37065c26ac2a8ece558680a31be4e4bad7091

diff --git a/generators/comicbook/unrar.cpp b/generators/comicbook/unrar.cpp
index 87f8bbb..b7a60a3 100644
--- a/generators/comicbook/unrar.cpp
+++ b/generators/comicbook/unrar.cpp
@@ -11,6 +11,7 @@
 
 #include <QtCore/QEventLoop>
 #include <QtCore/QFile>
+#include <QtCore/QFileInfo>
 #include <QtCore/QRegExp>
 
 #include <kdebug.h>
@@ -133,8 +134,11 @@ QStringList Unrar::list()
     const QStringList listFiles = helper->kind->processListing( \
QString::fromLocal8Bit( mStdOutData ).split( '\n', QString::SkipEmptyParts ) );  \
QStringList newList;  Q_FOREACH ( const QString &f, listFiles ) {
-        if ( QFile::exists( mTempDir->name() + f ) ) {
-            newList.append( f );
+        // Extract all the files to mTempDir regardless of their path inside the \
archive +        // This will break if ever an arvhice with two files with the same \
name in different subfolders +        QFileInfo fi( f );
+        if ( QFile::exists( mTempDir->name() + fi.fileName() ) ) {
+            newList.append( fi.fileName() );
         }
     }
     return newList;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic