Commit fe2cccec authored by Méven Car's avatar Méven Car
Browse files

With autodetect, extract single files archive in current dir

Summary: Treat single files archive as single folder archive basically.

Test Plan: ctest

Reviewers: #ark, elvisangelaccio, ngraham

Reviewed By: #ark, elvisangelaccio

Subscribers: kde-utils-devel

Tags: #ark

Differential Revision: https://phabricator.kde.org/D23693
parent efe39898
...@@ -191,7 +191,7 @@ int main(int argc, char **argv) ...@@ -191,7 +191,7 @@ int main(int argc, char **argv)
i18n("The destination argument will be set to the path of the first file supplied."))); i18n("The destination argument will be set to the path of the first file supplied.")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("a") << QStringLiteral("autosubfolder"), parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("a") << QStringLiteral("autosubfolder"),
i18n("Archive contents will be read, and if detected to not be a single folder archive, a subfolder with the name of the archive will be created."))); i18n("Archive contents will be read, and if detected to not be a single folder or a single file archive, a subfolder with the name of the archive will be created.")));
parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("m") << QStringLiteral("mimetypes"), parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("m") << QStringLiteral("mimetypes"),
i18n("List supported MIME types."))); i18n("List supported MIME types.")));
......
...@@ -90,7 +90,7 @@ void BatchExtractTest::testBatchExtraction_data() ...@@ -90,7 +90,7 @@ void BatchExtractTest::testBatchExtraction_data()
QTest::newRow("single-file, autosubfolder") QTest::newRow("single-file, autosubfolder")
<< QFINDTESTDATA("data/test.txt.gz") << QFINDTESTDATA("data/test.txt.gz")
<< true << true
<< 2; << 1;
} }
void BatchExtractTest::testBatchExtraction() void BatchExtractTest::testBatchExtraction()
......
...@@ -428,7 +428,7 @@ void BatchExtractJob::setupDestination() ...@@ -428,7 +428,7 @@ void BatchExtractJob::setupDestination()
const bool isSingleFolderRPM = (archive()->isSingleFolder() && const bool isSingleFolderRPM = (archive()->isSingleFolder() &&
(archive()->mimeType().name() == QLatin1String("application/x-rpm"))); (archive()->mimeType().name() == QLatin1String("application/x-rpm")));
if (m_autoSubfolder && (!archive()->isSingleFolder() || isSingleFolderRPM)) { if (m_autoSubfolder && (archive()->hasMultipleTopLevelEntries() || isSingleFolderRPM)) {
const QDir d(m_destination); const QDir d(m_destination);
QString subfolderName = archive()->subfolderName(); QString subfolderName = archive()->subfolderName();
......
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