#endif
#include <simgear/compiler.h>
+#include <simgear/misc/exception.hxx>
#include STL_STRING
SGPath props_path(globals->get_fg_root());
props_path.append("preferences.xml");
SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences");
- if (!readProperties(props_path.str(), globals->get_props())) {
- SG_LOG(SG_INPUT, SG_ALERT, "Failed to read global preferences from "
- << props_path.str());
- } else {
- SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
+ try {
+ readProperties(props_path.str(), globals->get_props());
+ } catch (const sg_io_exception &e) {
+ string message = "Error reading global preferences: ";
+ message += e.getMessage();
+ message += "\n at ";
+ message += e.getLocation().asString();
+ SG_LOG(SG_INPUT, SG_ALERT, message);
+ exit(2);
}
+ SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
// Attempt to locate and parse the various config files in order
// from least precidence to greatest precidence
#endif
#include <simgear/compiler.h>
+#include <simgear/misc/exception.hxx>
/* normans fix */
#if defined(FX) && defined(XMESA)
# include <NetworkOLK/network.h>
#endif
+#include <GUI/gui.h>
+
#include "globals.hxx"
#include "fg_init.hxx"
#include "fg_props.hxx"
parse_flightplan ( arg.substr (14) );
} else if ( arg.find( "--config=" ) == 0 ) {
string file = arg.substr(9);
- if (!readProperties(file, globals->get_props())) {
- SG_LOG(SG_IO, SG_ALERT,
- "--config: failed to read properties from " << file);
- return FG_OPTIONS_ERROR;
+ try {
+ readProperties(file, globals->get_props());
+ } catch (const sg_io_exception &e) {
+ string message = "Error loading config file: ";
+ message += e.getMessage();
+ message += "\n at ";
+ message += e.getLocation().asString();
+ SG_LOG(SG_INPUT, SG_ALERT, message);
+ exit(2);
}
} else {
SG_LOG( SG_GENERAL, SG_ALERT, "Unknown option '" << arg << "'" );