summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index bdc40f68..c8847534 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1919,12 +1919,18 @@ void MainWindow::updateBSAList(const QStringList& defaultArchives,
fileName.endsWith(".esl", Qt::CaseInsensitive);
});
+ QList<std::pair<QString, QString>> pluginNamePairs;
+ pluginNamePairs.reserve(plugins.size());
+ for (const QString& pluginName : plugins) {
+ QFileInfo pluginInfo(pluginName);
+ pluginNamePairs.append(
+ std::make_pair(pluginInfo.completeBaseName(), pluginInfo.fileName()));
+ }
+
auto hasAssociatedPlugin = [&](const QString& bsaName) -> bool {
- for (const QString& pluginName : plugins) {
- QFileInfo pluginInfo(pluginName);
- if (bsaName.startsWith(QFileInfo(pluginName).completeBaseName(),
- Qt::CaseInsensitive) &&
- (m_OrganizerCore.pluginList()->state(pluginInfo.fileName()) ==
+ for (const auto& [completeBaseName, fileName] : pluginNamePairs) {
+ if (bsaName.startsWith(completeBaseName, Qt::CaseInsensitive) &&
+ (m_OrganizerCore.pluginList()->state(fileName) ==
IPluginList::STATE_ACTIVE)) {
return true;
}