[Orxonox-commit 3123] r7817 - code/forks/pch_analyser/src/orxonox
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Dec 26 17:26:58 CET 2010
Author: rgrieder
Date: 2010-12-26 17:26:58 +0100 (Sun, 26 Dec 2010)
New Revision: 7817
Modified:
code/forks/pch_analyser/src/orxonox/Main.cc
Log:
Merged r7816 from sandbox_qt.
Modified: code/forks/pch_analyser/src/orxonox/Main.cc
===================================================================
--- code/forks/pch_analyser/src/orxonox/Main.cc 2010-12-26 16:16:12 UTC (rev 7816)
+++ code/forks/pch_analyser/src/orxonox/Main.cc 2010-12-26 16:26:58 UTC (rev 7817)
@@ -35,10 +35,16 @@
#include "Main.h"
+#include <memory>
#include <QApplication>
#include <QCoreApplication>
+#ifdef ORXONOX_PLATFORM_WINDOWS
+# include <windows.h>
+#endif
+
#include "util/Debug.h"
+#include "util/Exception.h"
#include "core/CommandLineParser.h"
#include "core/Core.h"
#include "Analyser.h"
@@ -56,10 +62,22 @@
{
QApplication app(argc, argv);
- QStringList arguments = QCoreApplication::arguments();
- if (!arguments.value(0).isEmpty() && arguments.value(0)[0] != '-')
- arguments.pop_front(); // Remove application path
- Core core(arguments.join(" ").toStdString());
+ std::auto_ptr<Core> core;
+ try
+ {
+ QStringList arguments = QCoreApplication::arguments();
+ if (!arguments.value(0).isEmpty() && arguments.value(0)[0] != '-')
+ arguments.pop_front(); // Remove application path
+ core.reset(new Core(arguments.join(" ").toStdString()));
+ }
+ catch (const Exception& ex)
+ {
+ COUT(0) << "Exception: " << ex.getDescription() << endl;
+#ifdef ORXONOX_PLATFORM_WINDOWS
+ MessageBox(NULL, ex.getDescription().c_str(), "Exception", MB_ICONERROR);
+#endif
+ return 1;
+ }
QCoreApplication::setOrganizationName("Orxonox");
QCoreApplication::setOrganizationDomain("www.orxonox.net");
@@ -70,8 +88,25 @@
versionString += QString::number(ORXONOX_VERSION_PATCH);
QCoreApplication::setApplicationVersion(versionString);
- parse();
+ // Define library path
+ // Note: May not work (untested) because QApplication was already created.
+ // However doing the beforehand is difficult because the Core is required.
+ QStringList libraryPaths = QCoreApplication::libraryPaths();
+ libraryPaths.prepend(PathConfig::getExecutablePath().path() + "/plugins");
+ QCoreApplication::setLibraryPaths(libraryPaths);
- return 0;
+ try
+ {
+ parse();
+ return 0;
+ }
+ catch (const Exception& ex)
+ {
+ COUT(0) << "Exception: " << ex.getDescription() << endl;
+#ifdef ORXONOX_PLATFORM_WINDOWS
+ MessageBox(NULL, ex.getDescription().c_str(), "Exception", MB_ICONERROR);
+#endif
+ return 1;
+ }
}
}
More information about the Orxonox-commit
mailing list