<commit_before>#include "pluginmanager.h"

#include <QApplication>
#include <QDir>
#include <QSettings>

#include <QDebug>

namespace OpenCOR {

PluginManager::PluginManager()
{
#ifndef Q_WS_MAC
    QString pluginsDir = "plugins";
#else
    QString pluginsDir = QString("..")+QDir::separator()+"PlugIns";
#endif

    mPluginsDir =  QDir(qApp->applicationDirPath()).canonicalPath()
                  +QDir::separator()+pluginsDir;

#ifdef Q_WS_MAC
    mPluginsDir += QDir::separator()+qApp->applicationName();
#endif
}

PluginManager::~PluginManager()
{
}

void PluginManager::loadPlugins(QSettings *pSettings)
{
    // Determine which plugins are available for loading

#ifdef Q_WS_WIN
    const QString extension = ".dll";
#elif defined(Q_WS_MAC)
    const QString extension = ".dylib";
#else
    const QString extension = ".so";
#endif

    QFileInfoList files = QDir(mPluginsDir).entryInfoList(QStringList("*"+extension), QDir::Files);
    QStringList pluginFiles;

    foreach (const QFileInfo &file, files)
{
        pluginFiles << file.canonicalFilePath();
qDebug() << "Plugin #" << pluginFiles.count() << ":" << pluginFiles.last();
}

//---GRY--- TO BE DONE...
}

}<commit_msg>Working on loading the plugins which currently fails since our 'plugins' are only shared libraries at this stage.<commit_after>#include "pluginmanager.h"

#include <QApplication>
#include <QDir>
#include <QPluginLoader>
#include <QSettings>

#include <QDebug>

namespace OpenCOR {

PluginManager::PluginManager()
{
#ifndef Q_WS_MAC
    QString pluginsDir = "plugins";
#else
    QString pluginsDir = QString("..")+QDir::separator()+"PlugIns";
#endif

    mPluginsDir =  QDir(qApp->applicationDirPath()).canonicalPath()
                  +QDir::separator()+pluginsDir;

#ifdef Q_WS_MAC
    mPluginsDir += QDir::separator()+qApp->applicationName();
#endif
}

PluginManager::~PluginManager()
{
}

void PluginManager::loadPlugins(QSettings *pSettings)
{
    // Determine which plugins are available for loading

#ifdef Q_WS_WIN
    const QString extension = ".dll";
#elif defined(Q_WS_MAC)
    const QString extension = ".dylib";
#else
    const QString extension = ".so";
#endif

    QFileInfoList files = QDir(mPluginsDir).entryInfoList(QStringList("*"+extension), QDir::Files);
    QStringList pluginFiles;

    foreach (const QFileInfo &file, files) {
        QString pluginFileName = file.canonicalFilePath();

        pluginFiles << pluginFileName;

        qDebug() << "Plugin #" << pluginFiles.count() << ":" << pluginFileName;

        QString pluginBaseName = QFileInfo(pluginFileName).baseName();

        if (!pluginBaseName.compare("Core") || !pluginBaseName.compare("Viewer")) {
            // Try to load the plugin as a 'proper' plugin

            QPluginLoader loader(pluginFileName);

            if (loader.load()) {
                qDebug() << " -" << pluginFileName << " loaded...";
            } else {
                qDebug() << " -" << pluginFileName << " NOT loaded...";
                qDebug() << "    ===>" << loader.errorString();
            }
        }
    }

    //---GRY--- TO BE DONE...
}

}
{'fraction_non_alphanumeric': 0.14745653573728268, 'fraction_numerical': 0.0, 'mean_word_length': 3.5028985507246375, 'pattern_counts': {'":': 2, '<': 48, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6861955', 'n_tokens_mistral': 960, 'n_tokens_neox': 925, 'n_words': 213}