From 0caba0846c9a9a0624f62e6e20330db1edb42623 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 11 Dec 2024 09:27:30 +0100 Subject: [PATCH] Fix installing just a library in plugin install wizard It is possible to just select a plugin library in the plugin install wizard, and that worked by just copying the library over. Amends be2e5262c73ef747511a10e04a36338d3d49412e that introduced a crash for that case, by unconditionally using the PluginSpec instance that was only created for the "archive" case. Instead of skipping the check archive step, also try to read a PluginSpec for pure library files. That has the advantage that we do some basic checks for them too, and that we have the PluginSpec instance available for the later code. Change-Id: I23286d81de54c08d4735c9bcdb2368c8b6097408 Reviewed-by: Marcus Tillmanns --- src/plugins/coreplugin/plugininstallwizard.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/plugininstallwizard.cpp b/src/plugins/coreplugin/plugininstallwizard.cpp index 796db4843d0..5547e685582 100644 --- a/src/plugins/coreplugin/plugininstallwizard.cpp +++ b/src/plugins/coreplugin/plugininstallwizard.cpp @@ -115,7 +115,7 @@ public: int nextId() const final { if (hasLibSuffix(m_data->sourcePath)) - return WizardPage::nextId() + 1; // jump over check archive + return WizardPage::nextId(); return WizardPage::nextId(); } @@ -185,6 +185,20 @@ public: { m_isComplete = false; emit completeChanged(); + if (hasLibSuffix(m_data->sourcePath)) { + m_cancelButton->setVisible(false); + expected_str> spec = readCppPluginSpec(m_data->sourcePath); + if (!spec) { + m_label->setType(InfoLabel::Error); + m_label->setText(spec.error()); + return; + } + m_label->setType(InfoLabel::Ok); + m_label->setText(Tr::tr("Archive is OK.")); + m_data->pluginSpec.swap(*spec); + m_isComplete = true; + return; + } m_tempDir = std::make_unique("plugininstall"); m_data->extractedPath = m_tempDir->path(); @@ -345,6 +359,7 @@ public: void initializePage() final { + QTC_ASSERT(m_data && m_data->pluginSpec, return); const FilePath installLocation = m_data->pluginSpec->installLocation( !m_data->installIntoApplication); installLocation.ensureWritableDir();