From bcc9f3f4316396a80d2f7dfbb901473d557415ff Mon Sep 17 00:00:00 2001 From: David Rosca Date: Thu, 16 Oct 2014 12:24:48 +0200 Subject: [PATCH] Portable: Fix auto-loading saved plugins on startup --- src/lib/plugins/plugins.cpp | 13 ++++++++----- src/lib/preferences/pluginsmanager.cpp | 9 ++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/lib/plugins/plugins.cpp b/src/lib/plugins/plugins.cpp index a134a7138..f9100a102 100644 --- a/src/lib/plugins/plugins.cpp +++ b/src/lib/plugins/plugins.cpp @@ -87,6 +87,13 @@ void Plugins::loadSettings() m_allowedPlugins = settings.value("AllowedPlugins", QStringList()).toStringList(); settings.endGroup(); + // Plugins are saved with relative path in portable mode + if (mApp->isPortable()) { + QDir dir(DataPaths::path(DataPaths::Plugins)); + for (int i = 0; i < m_allowedPlugins.count(); ++i) + m_allowedPlugins[i] = dir.absoluteFilePath(m_allowedPlugins[i]); + } + c2f_loadSettings(); } @@ -166,12 +173,8 @@ void Plugins::loadAvailablePlugins() QStringList dirs = DataPaths::allPaths(DataPaths::Plugins); // Portable build: Load only plugins from DATADIR/plugins/ directory. - // Loaded plugins are saved with relative path, instead of absolute for - // normal build. - - if (mApp->isPortable()) { + if (mApp->isPortable()) dirs = QStringList(DataPaths::path(DataPaths::Plugins)); - } foreach (const QString &dir, dirs) { QDir pluginsDir = QDir(dir); diff --git a/src/lib/preferences/pluginsmanager.cpp b/src/lib/preferences/pluginsmanager.cpp index 6ecdf2860..6133c4344 100644 --- a/src/lib/preferences/pluginsmanager.cpp +++ b/src/lib/preferences/pluginsmanager.cpp @@ -115,12 +115,11 @@ void PluginsManager::save() if (item->checkState() == Qt::Checked) { const Plugins::Plugin plugin = item->data(Qt::UserRole + 10).value(); - if (!mApp->isPortable()) { - allowedPlugins.append(plugin.fullPath); - } - else { + // Save plugins with relative path in portable mode + if (mApp->isPortable()) allowedPlugins.append(plugin.fileName); - } + else + allowedPlugins.append(plugin.fullPath); } }