Changeset View
Changeset View
Standalone View
Standalone View
src/core/atcore.cpp
Show First 20 Lines • Show All 605 Lines • ▼ Show 20 Line(s) | |||||
606 | bool AtCore::firmwarePluginLoaded() const | 606 | bool AtCore::firmwarePluginLoaded() const | ||
607 | { | 607 | { | ||
608 | return firmwarePlugin(); | 608 | return firmwarePlugin(); | ||
609 | } | 609 | } | ||
610 | 610 | | |||
611 | QMap<QString, QString> AtCore::findFirmwarePlugins(const QString &path) | 611 | QMap<QString, QString> AtCore::findFirmwarePlugins(const QString &path) | ||
612 | { | 612 | { | ||
613 | QMap<QString, QString> detectedPlugins; | 613 | QMap<QString, QString> detectedPlugins; | ||
614 | QStringList files = QDir(path).entryList(QDir::Files); | 614 | for (const QString &f : QDir(path).entryList({AtCoreDirectories::pluginExtFilter}, QDir::Files)) { | ||
615 | for (const QString &f : files) { | | |||
616 | QString file = f; | 615 | QString file = f; | ||
617 | #if defined(Q_OS_WIN) | 616 | file = file.split(QStringLiteral(".")).at(0).toLower().simplified(); | ||
618 | if (file.endsWith(QStringLiteral(".dll"))) | | |||
619 | #elif defined(Q_OS_MAC) | | |||
620 | if (file.endsWith(QStringLiteral(".dylib"))) | | |||
621 | #else | | |||
622 | if (file.endsWith(QStringLiteral(".so"))) | | |||
623 | #endif | | |||
624 | file = file.split(QChar::fromLatin1('.')).at(0); | | |||
625 | else { | | |||
626 | continue; | | |||
627 | } | | |||
628 | if (file.startsWith(QStringLiteral("lib"))) { | 617 | if (file.startsWith(QStringLiteral("lib"))) { | ||
629 | file = file.remove(QStringLiteral("lib")); | 618 | file = file.remove(QStringLiteral("lib")); | ||
630 | } | 619 | } | ||
631 | file = file.toLower().simplified(); | 620 | QString pluginString = QStringLiteral("%1/%2").arg(path, f); | ||
632 | QString pluginString = path; | | |||
633 | pluginString.append(QChar::fromLatin1('/')); | | |||
634 | pluginString.append(f); | | |||
635 | detectedPlugins[file] = pluginString; | 621 | detectedPlugins[file] = pluginString; | ||
636 | qCDebug(ATCORE_PLUGIN) << QStringLiteral("Plugin:[%1]=%2").arg(file, pluginString); | 622 | qCDebug(ATCORE_PLUGIN) << QStringLiteral("Plugin:[%1]=%2").arg(file, pluginString); | ||
637 | } | 623 | } | ||
638 | return detectedPlugins; | 624 | return detectedPlugins; | ||
639 | } | 625 | } | ||
640 | 626 | | |||
641 | QStringList AtCore::availableFirmwarePlugins() const | 627 | QStringList AtCore::availableFirmwarePlugins() const | ||
642 | { | 628 | { | ||
▲ Show 20 Lines • Show All 331 Lines • Show Last 20 Lines |