Commit 045a847d authored by Ragnar Thomsen's avatar Ragnar Thomsen

Set compression level in libarchiveplugin

Summary: This sets compression level in libarchiveplugin if CompressionLevel is passed in CompressionOptions.

Reviewers: elvisangelaccio

Reviewed By: elvisangelaccio

Subscribers: kde-utils-devel

Projects: #ark

Differential Revision: https://phabricator.kde.org/D1256
parent df39ac39
......@@ -184,6 +184,18 @@ bool ReadWriteLibarchivePlugin::addFiles(const QStringList& files, const Compres
QLatin1String(archive_error_string(arch_writer.data()))));
return false;
}
// Set compression level if passed in CompressionOptions.
if (options.contains(QStringLiteral("CompressionLevel"))) {
qCDebug(ARK) << "Using compression level:" << options.value(QStringLiteral("CompressionLevel")).toString();
ret = archive_write_set_filter_option(arch_writer.data(), NULL, "compression-level", options.value(QStringLiteral("CompressionLevel")).toString().toUtf8());
if (ret != ARCHIVE_OK) {
qCWarning(ARK) << "Failed to set compression level";
emit error(xi18nc("@info", "Setting the compression level failed with the following error:<nl/><message>%1</message>",
QLatin1String(archive_error_string(arch_writer.data()))));
return false;
}
}
}
ret = archive_write_open_fd(arch_writer.data(), tempFile.handle());
......
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