}
_searchAircraft = aircraft + "-set.xml";
+ std::string aircraftDir = fgGetString("/sim/aircraft-dir", "");
+ if (!aircraftDir.empty()) {
+ // aircraft-dir was set, skip any searching at all, if it's valid
+ simgear::Dir acPath(aircraftDir);
+ SGPath setFile = acPath.file(_searchAircraft);
+ if (setFile.exists()) {
+ SG_LOG(SG_GENERAL, SG_INFO, "found aircraft in dir: " << aircraftDir );
+
+ try {
+ readProperties(setFile.str(), globals->get_props());
+ } catch ( const sg_exception &e ) {
+ SG_LOG(SG_INPUT, SG_ALERT, "Error reading aircraft: " << e.getFormattedMessage());
+ return false;
+ }
+
+ return true;
+ } else {
+ SG_LOG(SG_GENERAL, SG_ALERT, "aircraft '" << _searchAircraft <<
+ "' not found in specified dir:" << aircraftDir);
+ return false;
+ }
+ }
+
if (!checkCache()) {
// prepare cache for re-scan
SGPropertyNode *n = _cache->getNode("fg-root", true);
{"fg-aircraft", true, OPTION_IGNORE | OPTION_MULTI, "", false, "", 0 },
{"fdm", true, OPTION_STRING, "/sim/flight-model", false, "", 0 },
{"aero", true, OPTION_STRING, "/sim/aero", false, "", 0 },
- {"aircraft-dir", true, OPTION_STRING, "/sim/aircraft-dir", false, "", 0 },
+ {"aircraft-dir", true, OPTION_IGNORE, "", false, "", 0 },
{"model-hz", true, OPTION_INT, "/sim/model-hz", false, "", 0 },
{"speed", true, OPTION_INT, "/sim/speed-up", false, "", 0 },
{"trim", false, OPTION_BOOL, "/sim/presets/trim", true, "", 0 },
fgShowAircraft(path);
exit(0);
}
+
+ if (isOptionSet("aircraft-dir")) {
+ // set this now, so it's available in FindAndCacheAircraft
+ fgSetString("/sim/aircraft-dir", valueForOption("aircraft-dir"));
+ }
}
void Options::processArgResult(int result)