Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7817


Ignore:
Timestamp:
Dec 26, 2010, 5:26:58 PM (14 years ago)
Author:
rgrieder
Message:

Merged r7816 from sandbox_qt.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/forks/pch_analyser/src/orxonox/Main.cc

    r7815 r7817  
    3636#include "Main.h"
    3737
     38#include <memory>
    3839#include <QApplication>
    3940#include <QCoreApplication>
    4041
     42#ifdef ORXONOX_PLATFORM_WINDOWS
     43#  include <windows.h>
     44#endif
     45
    4146#include "util/Debug.h"
     47#include "util/Exception.h"
    4248#include "core/CommandLineParser.h"
    4349#include "core/Core.h"
     
    5763        QApplication app(argc, argv);
    5864
    59         QStringList arguments = QCoreApplication::arguments();
    60         if (!arguments.value(0).isEmpty() && arguments.value(0)[0] != '-')
    61             arguments.pop_front(); // Remove application path
    62         Core core(arguments.join(" ").toStdString());
     65        std::auto_ptr<Core> core;
     66        try
     67        {
     68            QStringList arguments = QCoreApplication::arguments();
     69            if (!arguments.value(0).isEmpty() && arguments.value(0)[0] != '-')
     70                arguments.pop_front(); // Remove application path
     71            core.reset(new Core(arguments.join(" ").toStdString()));
     72        }
     73        catch (const Exception& ex)
     74        {
     75            COUT(0) << "Exception: " << ex.getDescription() << endl;
     76#ifdef ORXONOX_PLATFORM_WINDOWS
     77            MessageBox(NULL, ex.getDescription().c_str(), "Exception", MB_ICONERROR);
     78#endif
     79            return 1;
     80        }
    6381
    6482        QCoreApplication::setOrganizationName("Orxonox");
     
    7189        QCoreApplication::setApplicationVersion(versionString);
    7290
    73         parse();
     91        // Define library path
     92        // Note: May not work (untested) because QApplication was already created.
     93        // However doing the beforehand is difficult because the Core is required.
     94        QStringList libraryPaths = QCoreApplication::libraryPaths();
     95        libraryPaths.prepend(PathConfig::getExecutablePath().path() + "/plugins");
     96        QCoreApplication::setLibraryPaths(libraryPaths);
    7497
    75         return 0;
     98        try
     99        {
     100            parse();
     101            return 0;
     102        }
     103        catch (const Exception& ex)
     104        {
     105            COUT(0) << "Exception: " << ex.getDescription() << endl;
     106#ifdef ORXONOX_PLATFORM_WINDOWS
     107            MessageBox(NULL, ex.getDescription().c_str(), "Exception", MB_ICONERROR);
     108#endif
     109            return 1;
     110        }
    76111    }
    77112}
Note: See TracChangeset for help on using the changeset viewer.