| 20 | : p7zipPath(p7zipPath), operationTimeoutMsecs(operationTimeoutMsecs) {} |
| 21 | |
| 22 | QStringList P7ZipDecoder::listArchiveFiles(const QString& archivePath) const { |
| 23 | QString stdoutBuff = readP7ZipOutput({"l", "-slt", archivePath}); |
| 24 | |
| 25 | #ifdef Q_OS_WIN |
| 26 | QRegExp r("\r\nPath = ([^\r\n]*)\r\n"); |
| 27 | #else |
| 28 | QRegExp r("\nPath = ([^\n]*)\n"); |
| 29 | #endif |
| 30 | r.setPatternSyntax(QRegExp::RegExp2); |
| 31 | |
| 32 | QStringList files; |
| 33 | int offset = 0; |
| 34 | |
| 35 | while ((offset = r.indexIn(stdoutBuff, offset)) != -1) { |
| 36 | files << r.cap(1); |
| 37 | offset += r.matchedLength(); |
| 38 | } |
| 39 | |
| 40 | return files; |
| 41 | } |
| 42 | |
| 43 | bool P7ZipDecoder::unpackArchiveFile(const QString& archivePath, |
| 44 | const QString& filename, |