<commit_before>//==============================================================================
// Main source file
//==============================================================================

#include "common.h"

//==============================================================================

#include <iostream>

//==============================================================================

#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <QPointer>
#include <QProcess>

//==============================================================================

using namespace OpenCOR;

//==============================================================================

int main(int pArgc, char *pArgv[])
{
    // Create the application

    QCoreApplication *app = new QCoreApplication(pArgc, pArgv);

    // Some general initialisations

    initApplication(app);

    // Try to run OpenCOR as a console application

    int res;

    if (!consoleApplication(app, &res)) {
        // OpenCOR wasn't run as a proper console application, so start its GUI
        // version instead

        static const QString dotExe = ".exe";

        if (app->applicationFilePath().right(dotExe.size()) == dotExe) {
            // This is a safeguard from accidentally running a non-renamed (to
            // '.com') console version of OpenCOR

            error(app, "the console version of "+app->applicationName()+" has the wrong extension ('.exe' instead of '.com').");

            res = -1;
        } else {
            QString guiAppFilePath = app->applicationDirPath()+QDir::separator()+app->applicationName()+dotExe;

            if (!QFileInfo(guiAppFilePath).exists()) {
                // We can't find the GUI version of OpenCOR, so...

                error(app, "the GUI version of "+app->applicationName()+" cannot be found.");

                res = -1;
            } else {
                QProcess().startDetached(guiAppFilePath, app->arguments(), QProcess().workingDirectory());

                res = 0;
            }
        }
    }

    // Release some memory

    delete app;

    // We are done, so...

    return res;
}

//==============================================================================
// End of file
//==============================================================================<commit_msg>Some minor cleaning up (#57).<commit_after>//==============================================================================
// Main source file
//==============================================================================

#include "common.h"

//==============================================================================

#include <iostream>

//==============================================================================

#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <QPointer>
#include <QProcess>

//==============================================================================

int main(int pArgc, char *pArgv[])
{
    // Create the application

    QCoreApplication *app = new QCoreApplication(pArgc, pArgv);

    // Some general initialisations

    OpenCOR::initApplication(app);

    // Try to run OpenCOR as a console application

    int res;

    if (!OpenCOR::consoleApplication(app, &res)) {
        // OpenCOR wasn't run as a proper console application, so start its GUI
        // version instead

        static const QString dotExe = ".exe";

        if (app->applicationFilePath().right(dotExe.size()) == dotExe) {
            // This is a safeguard from accidentally running a non-renamed (to
            // '.com') console version of OpenCOR

            OpenCOR::error(app, "the console version of "+app->applicationName()+" has the wrong extension ('.exe' instead of '.com').");

            res = -1;
        } else {
            QString guiAppFilePath = app->applicationDirPath()+QDir::separator()+app->applicationName()+dotExe;

            if (!QFileInfo(guiAppFilePath).exists()) {
                // We can't find the GUI version of OpenCOR, so...

                OpenCOR::error(app, "the GUI version of "+app->applicationName()+" cannot be found.");

                res = -1;
            } else {
                QProcess().startDetached(guiAppFilePath, app->arguments(), QProcess().workingDirectory());

                res = 0;
            }
        }
    }

    // Release some memory

    delete app;

    // We are done, so...

    return res;
}

//==============================================================================
// End of file
//==============================================================================
{'fraction_non_alphanumeric': 0.35118279569892474, 'fraction_numerical': 0.0017204301075268817, 'mean_word_length': 3.205244122965642, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 27, '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': '1425705', 'n_tokens_mistral': 1144, 'n_tokens_neox': 1000, 'n_words': 303}