From 2cc1111e83173224f5dec54450fb06970cd78f7e Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Mon, 28 Feb 2022 22:45:28 +0100 Subject: [PATCH] Cache result of libarchiveHasLzo It is extremely slow (~100 ms on my machine) and hardly changes. --- kerfuffle/pluginmanager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kerfuffle/pluginmanager.cpp b/kerfuffle/pluginmanager.cpp index ef379a84..50b1f7a8 100644 --- a/kerfuffle/pluginmanager.cpp +++ b/kerfuffle/pluginmanager.cpp @@ -122,8 +122,9 @@ QStringList PluginManager::supportedMimeTypes(MimeSortingMode mode) const supported.remove(QStringLiteral("application/x-lz4-compressed-tar")); } + static bool s_libarchiveHasLzo = libarchiveHasLzo(); // Remove entry for lzo-compressed tar if libarchive not linked against lzo and lzop executable not found in path. - if (!libarchiveHasLzo() && QStandardPaths::findExecutable(QStringLiteral("lzop")).isEmpty()) { + if (!s_libarchiveHasLzo && QStandardPaths::findExecutable(QStringLiteral("lzop")).isEmpty()) { supported.remove(QStringLiteral("application/x-tzo")); } -- GitLab