summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2016-06-01 10:05:46 +0200
committerElvis Angelaccio <[email protected]>2016-06-01 10:06:22 +0200
commit27e5167bd65290a82fde1962a710f3baf141a48c (patch)
tree18af5a38d1e336bb94fc796007000947b46c930d
parent1b812373e55768e11bf574177bde2c8aa3414626 (diff)
Drop RootNode extraction option
We never set this option and because of this there is a lot of unused code (e.g. all the `RootNodeSwitch` stuff). Digging in the history, the last time that this option was set was in commit 10bc72f453a253. This means that this option is fully superseded by `fileNodeRootPair` and we can safely discard all this unused code. Closes T1942 Differential Revision: D1704
-rw-r--r--autotests/plugins/cli7zplugin/cli7ztest.cpp2
-rw-r--r--autotests/plugins/clirarplugin/clirartest.cpp25
-rw-r--r--autotests/plugins/cliunarchiverplugin/cliunarchivertest.cpp2
-rw-r--r--autotests/plugins/clizipplugin/cliziptest.cpp2
-rw-r--r--kerfuffle/cliinterface.cpp30
-rw-r--r--kerfuffle/cliinterface.h15
-rw-r--r--plugins/clirarplugin/cliplugin.cpp1
-rw-r--r--plugins/libarchive/libarchiveplugin.cpp17
8 files changed, 15 insertions, 79 deletions
diff --git a/autotests/plugins/cli7zplugin/cli7ztest.cpp b/autotests/plugins/cli7zplugin/cli7ztest.cpp
index 06be1b5..77dad77 100644
--- a/autotests/plugins/cli7zplugin/cli7ztest.cpp
+++ b/autotests/plugins/cli7zplugin/cli7ztest.cpp
@@ -372,7 +372,7 @@ void Cli7zTest::testExtractArgs()
QFETCH(bool, preservePaths);
QFETCH(QString, password);
- QStringList replacedArgs = plugin->substituteCopyVariables(extractArgs, files, preservePaths, password, QString());
+ QStringList replacedArgs = plugin->substituteCopyVariables(extractArgs, files, preservePaths, password);
QVERIFY(replacedArgs.size() >= extractArgs.size());
QFETCH(QStringList, expectedArgs);
diff --git a/autotests/plugins/clirarplugin/clirartest.cpp b/autotests/plugins/clirarplugin/clirartest.cpp
index 1e3bf4c..b069392 100644
--- a/autotests/plugins/clirarplugin/clirartest.cpp
+++ b/autotests/plugins/clirarplugin/clirartest.cpp
@@ -329,74 +329,69 @@ void CliRarTest::testExtractArgs_data()
QTest::addColumn<QVariantList>("files");
QTest::addColumn<bool>("preservePaths");
QTest::addColumn<QString>("password");
- QTest::addColumn<QString>("rootNode");
QTest::addColumn<QStringList>("expectedArgs");
- QTest::newRow("preserve paths, encrypted, root node")
+ QTest::newRow("preserve paths, encrypted")
<< QStringLiteral("/tmp/foo.rar")
<< QVariantList {
QVariant::fromValue(fileRootNodePair(QStringLiteral("aDir/b.txt"), QStringLiteral("aDir"))),
QVariant::fromValue(fileRootNodePair(QStringLiteral("c.txt"), QString()))
}
- << true << QStringLiteral("1234") << QStringLiteral("aDir")
+ << true << QStringLiteral("1234")
<< QStringList {
QStringLiteral("-kb"),
QStringLiteral("-p-"),
QStringLiteral("x"),
QStringLiteral("-p1234"),
- QStringLiteral("-apaDir"),
QStringLiteral("/tmp/foo.rar"),
QStringLiteral("aDir/b.txt"),
QStringLiteral("c.txt"),
};
- QTest::newRow("preserve paths, unencrypted, root node")
+ QTest::newRow("preserve paths, unencrypted")
<< QStringLiteral("/tmp/foo.rar")
<< QVariantList {
QVariant::fromValue(fileRootNodePair(QStringLiteral("aDir/b.txt"), QStringLiteral("aDir"))),
QVariant::fromValue(fileRootNodePair(QStringLiteral("c.txt"), QString()))
}
- << true << QString() << QStringLiteral("aDir")
+ << true << QString()
<< QStringList {
QStringLiteral("-kb"),
QStringLiteral("-p-"),
QStringLiteral("x"),
- QStringLiteral("-apaDir"),
QStringLiteral("/tmp/foo.rar"),
QStringLiteral("aDir/b.txt"),
QStringLiteral("c.txt"),
};
- QTest::newRow("without paths, encrypted, root node")
+ QTest::newRow("without paths, encrypted")
<< QStringLiteral("/tmp/foo.rar")
<< QVariantList {
QVariant::fromValue(fileRootNodePair(QStringLiteral("aDir/b.txt"), QStringLiteral("aDir"))),
QVariant::fromValue(fileRootNodePair(QStringLiteral("c.txt"), QString()))
}
- << false << QStringLiteral("1234") << QStringLiteral("aDir")
+ << false << QStringLiteral("1234")
<< QStringList {
QStringLiteral("-kb"),
QStringLiteral("-p-"),
QStringLiteral("e"),
QStringLiteral("-p1234"),
- QStringLiteral("-apaDir"),
QStringLiteral("/tmp/foo.rar"),
QStringLiteral("aDir/b.txt"),
QStringLiteral("c.txt"),
};
- QTest::newRow("without paths, unencrypted, root node")
+ QTest::newRow("without paths, unencrypted")
<< QStringLiteral("/tmp/foo.rar")
<< QVariantList {
QVariant::fromValue(fileRootNodePair(QStringLiteral("aDir/b.txt"), QStringLiteral("aDir"))),
QVariant::fromValue(fileRootNodePair(QStringLiteral("c.txt"), QString()))
}
- << false << QString() << QStringLiteral("aDir")
+ << false << QString()
<< QStringList {
QStringLiteral("-kb"),
QStringLiteral("-p-"),
QStringLiteral("e"),
- QStringLiteral("-apaDir"),
QStringLiteral("/tmp/foo.rar"),
QStringLiteral("aDir/b.txt"),
QStringLiteral("c.txt"),
@@ -413,16 +408,14 @@ void CliRarTest::testExtractArgs()
QStringLiteral("-p-"),
QStringLiteral("$PreservePathSwitch"),
QStringLiteral("$PasswordSwitch"),
- QStringLiteral("$RootNodeSwitch"),
QStringLiteral("$Archive"),
QStringLiteral("$Files") };
QFETCH(QVariantList, files);
QFETCH(bool, preservePaths);
QFETCH(QString, password);
- QFETCH(QString, rootNode);
- QStringList replacedArgs = rarPlugin->substituteCopyVariables(extractArgs, files, preservePaths, password, rootNode);
+ QStringList replacedArgs = rarPlugin->substituteCopyVariables(extractArgs, files, preservePaths, password);
QVERIFY(replacedArgs.size() >= extractArgs.size());
QFETCH(QStringList, expectedArgs);
diff --git a/autotests/plugins/cliunarchiverplugin/cliunarchivertest.cpp b/autotests/plugins/cliunarchiverplugin/cliunarchivertest.cpp
index 5169ef8..9bc3672 100644
--- a/autotests/plugins/cliunarchiverplugin/cliunarchivertest.cpp
+++ b/autotests/plugins/cliunarchiverplugin/cliunarchivertest.cpp
@@ -374,7 +374,7 @@ void CliUnarchiverTest::testExtractArgs()
QFETCH(QVariantList, files);
QFETCH(QString, password);
- QStringList replacedArgs = plugin->substituteCopyVariables(extractArgs, files, false, password, QString());
+ QStringList replacedArgs = plugin->substituteCopyVariables(extractArgs, files, false, password);
QVERIFY(replacedArgs.size() >= extractArgs.size());
QFETCH(QStringList, expectedArgs);
diff --git a/autotests/plugins/clizipplugin/cliziptest.cpp b/autotests/plugins/clizipplugin/cliziptest.cpp
index 11c1e45..5f066d8 100644
--- a/autotests/plugins/clizipplugin/cliziptest.cpp
+++ b/autotests/plugins/clizipplugin/cliziptest.cpp
@@ -194,7 +194,7 @@ void CliZipTest::testExtractArgs()
QFETCH(bool, preservePaths);
QFETCH(QString, password);
- QStringList replacedArgs = plugin->substituteCopyVariables(extractArgs, files, preservePaths, password, QString());
+ QStringList replacedArgs = plugin->substituteCopyVariables(extractArgs, files, preservePaths, password);
QFETCH(QStringList, expectedArgs);
QCOMPARE(replacedArgs, expectedArgs);
diff --git a/kerfuffle/cliinterface.cpp b/kerfuffle/cliinterface.cpp
index 1d2f8cb..f72b3ea 100644
--- a/kerfuffle/cliinterface.cpp
+++ b/kerfuffle/cliinterface.cpp
@@ -133,8 +133,7 @@ bool CliInterface::copyFiles(const QVariantList &files, const QString &destinati
const QStringList args = substituteCopyVariables(extractArgs,
files,
options.value(QStringLiteral("PreservePaths")).toBool(),
- password(),
- options.value(QStringLiteral("RootNode"), QString()).toString());
+ password());
QUrl destDir = QUrl(destinationDirectory);
QDir::setCurrent(destDir.adjusted(QUrl::RemoveScheme).url());
@@ -597,7 +596,7 @@ QStringList CliInterface::substituteListVariables(const QStringList &listArgs, c
return args;
}
-QStringList CliInterface::substituteCopyVariables(const QStringList &extractArgs, const QVariantList &files, bool preservePaths, const QString &password, const QString &rootNode)
+QStringList CliInterface::substituteCopyVariables(const QStringList &extractArgs, const QVariantList &files, bool preservePaths, const QString &password)
{
// Required if we call this function from unit tests.
cacheParameterList();
@@ -621,11 +620,6 @@ QStringList CliInterface::substituteCopyVariables(const QStringList &extractArgs
continue;
}
- if (arg == QLatin1String("$RootNodeSwitch")) {
- args << rootNodeSwitch(rootNode);
- continue;
- }
-
if (arg == QLatin1String("$Files")) {
args << copyFilesList(files);
continue;
@@ -833,26 +827,6 @@ QString CliInterface::compressionLevelSwitch(int level) const
return compLevelSwitch;
}
-QStringList CliInterface::rootNodeSwitch(const QString &rootNode) const
-{
- if (rootNode.isEmpty()) {
- return QStringList();
- }
-
- Q_ASSERT(m_param.contains(RootNodeSwitch));
-
- QStringList rootNodeSwitch = m_param.value(RootNodeSwitch).toStringList();
- Q_ASSERT(!rootNodeSwitch.isEmpty() && rootNodeSwitch.size() <= 2);
-
- if (rootNodeSwitch.size() == 1) {
- rootNodeSwitch[0].replace(QLatin1String("$Path"), rootNode);
- } else {
- rootNodeSwitch[1] = rootNode;
- }
-
- return rootNodeSwitch;
-}
-
QStringList CliInterface::copyFilesList(const QVariantList& files) const
{
QStringList filesList;
diff --git a/kerfuffle/cliinterface.h b/kerfuffle/cliinterface.h
index 4a95841..d0fdb20 100644
--- a/kerfuffle/cliinterface.h
+++ b/kerfuffle/cliinterface.h
@@ -132,14 +132,6 @@ enum CliInterfaceParameters {
PreservePathSwitch,
/**
* QStringList (default empty)
- * The format of the root node switch. The variable $Path will be
- * substituted for the path string.
- * Example: ("--internalPath=$Path)
- * or ("--path", "$Path")
- */
- RootNodeSwitch,
- /**
- * QStringList (default empty)
* The format of the root node switch. The variable $Password will be
* substituted for the password string. NOTE: supplying passwords
* through a virtual terminal is not supported (yet?), because this
@@ -320,7 +312,7 @@ public:
bool moveToDestination(const QDir &tempDir, const QDir &destDir, bool preservePaths);
QStringList substituteListVariables(const QStringList &listArgs, const QString &password);
- QStringList substituteCopyVariables(const QStringList &extractArgs, const QVariantList &files, bool preservePaths, const QString &password, const QString &rootNode);
+ QStringList substituteCopyVariables(const QStringList &extractArgs, const QVariantList &files, bool preservePaths, const QString &password);
QStringList substituteAddVariables(const QStringList &addArgs, const QStringList &files, const QString &password, bool encryptHeader, int compLevel);
QStringList substituteDeleteVariables(const QStringList &deleteArgs, const QVariantList &files, const QString &password);
QStringList substituteCommentVariables(const QStringList &commentArgs, const QString &commentFile);
@@ -347,11 +339,6 @@ public:
QString compressionLevelSwitch(int level) const;
/**
- * @return The root node switch with the given @p rootNode.
- */
- QStringList rootNodeSwitch(const QString& rootNode) const;
-
- /**
* @return The list of selected files to extract.
*/
QStringList copyFilesList(const QVariantList& files) const;
diff --git a/plugins/clirarplugin/cliplugin.cpp b/plugins/clirarplugin/cliplugin.cpp
index c11811b..d284fed 100644
--- a/plugins/clirarplugin/cliplugin.cpp
+++ b/plugins/clirarplugin/cliplugin.cpp
@@ -94,7 +94,6 @@ ParameterList CliPlugin::parameterList() const
<< QStringLiteral( "$Files" );
p[PreservePathSwitch] = QStringList() << QStringLiteral( "x" )
<< QStringLiteral( "e" );
- p[RootNodeSwitch] = QStringList() << QStringLiteral( "-ap$Path" );
p[PasswordSwitch] = QStringList() << QStringLiteral( "-p$Password" );
p[PasswordHeaderSwitch] = QStringList() << QStringLiteral("-hp$Password");
p[CompressionLevelSwitch] = QStringLiteral("-m$CompressionLevel");
diff --git a/plugins/libarchive/libarchiveplugin.cpp b/plugins/libarchive/libarchiveplugin.cpp
index 56f9160..934e5a2 100644
--- a/plugins/libarchive/libarchiveplugin.cpp
+++ b/plugins/libarchive/libarchiveplugin.cpp
@@ -155,12 +155,6 @@ bool LibarchivePlugin::copyFiles(const QVariantList& files, const QString& desti
const bool preservePaths = options.value(QStringLiteral( "PreservePaths" )).toBool();
bool removeRootNode = options.value(QStringLiteral("RemoveRootNode"), QVariant()).toBool();
- // See if there is a singular RootNode.
- QString rootNodeSingular = options.value(QStringLiteral("RootNode"), QVariant()).toString();
- if (!rootNodeSingular.isEmpty() && !rootNodeSingular.endsWith(QLatin1Char('/'))) {
- rootNodeSingular.append(QLatin1Char('/'));
- }
-
// To avoid traversing the entire archive when extracting a limited set of
// entries, we maintain a list of remaining entries and stop when it's
// empty.
@@ -299,17 +293,6 @@ bool LibarchivePlugin::copyFiles(const QVariantList& files, const QString& desti
const QString truncatedFilename(entryName.remove(0, files.at(index).value<fileRootNodePair>().rootNode.size()));
archive_entry_copy_pathname(entry, QFile::encodeName(truncatedFilename).constData());
entryFI = QFileInfo(truncatedFilename);
-
- // OR, if a singular rootNode is provided, remove it from file path.
- } else if (removeRootNode &&
- entryName != fileBeingRenamed &&
- !rootNodeSingular.isEmpty()) {
-
- //qCDebug(ARK) << "Removing" << rootNodeSingular << "from" << entryName;
-
- const QString truncatedFilename(entryName.remove(0, rootNodeSingular.size()));
- archive_entry_copy_pathname(entry, QFile::encodeName(truncatedFilename).constData());
- entryFI = QFileInfo(truncatedFilename);
}
// Check if the file about to be written already exists.