Changeset 7817
- Timestamp:
- Dec 26, 2010, 5:26:58 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/forks/pch_analyser/src/orxonox/Main.cc
r7815 r7817 36 36 #include "Main.h" 37 37 38 #include <memory> 38 39 #include <QApplication> 39 40 #include <QCoreApplication> 40 41 42 #ifdef ORXONOX_PLATFORM_WINDOWS 43 # include <windows.h> 44 #endif 45 41 46 #include "util/Debug.h" 47 #include "util/Exception.h" 42 48 #include "core/CommandLineParser.h" 43 49 #include "core/Core.h" … … 57 63 QApplication app(argc, argv); 58 64 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 } 63 81 64 82 QCoreApplication::setOrganizationName("Orxonox"); … … 71 89 QCoreApplication::setApplicationVersion(versionString); 72 90 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); 74 97 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 } 76 111 } 77 112 }
Note: See TracChangeset
for help on using the changeset viewer.