diff --git a/man/fgfs.1.in b/man/fgfs.1.in index 6e1c166d8..464212afe 100644 --- a/man/fgfs.1.in +++ b/man/fgfs.1.in @@ -40,8 +40,8 @@ Specify aerodynamics model to load. Specify aircraft to load. .TP .BI "--aircraft-dir=" "path" -Specify the aircraft model directory relative to the path of the -executable. This is used for UIUC aircraft only. +Specify the exact directory to use for the aircraft (normally not required, +but may be useful for testing). .TP .BI "--airport=" "id" Specify starting postion by airport ID. @@ -226,6 +226,9 @@ or electrical. Multiple instances allowed. Specify the flight dynamics model to use. Name may be one of jsb, larcsim, yasim, magic, balloon, ada, external, or null. .TP +.BI "--fg-aircraft=" "path" +Specify an additional path to search for aircraft directories. (can be repeated) +.TP .BI "--fg-root=" "path" Specify the root path for data files. .TP diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index eede54b6a..a648a35c9 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -346,31 +346,17 @@ bool FGAIBase::init(bool search_in_AI_path) string f; if(search_in_AI_path) { - // setup a modified Options structure, with only the $fg-root/AI defined; - // we'll check that first, then give the normal search logic a chance. - // this ensures that models in AI/ are preferred to normal models, where - // both exist. - osg::ref_ptr - opt(osg::clone(osgDB::Registry::instance()->getOptions(), osg::CopyOp::SHALLOW_COPY)); - - osgDB::FilePathList& paths(opt->getDatabasePathList()); - paths.clear(); BOOST_FOREACH(SGPath p, globals->get_data_paths("AI")) { - paths.push_back(p.str()); - } - - // search models in --fg-aircraft paths; - // when a copy of an aircraft is in --fg-aircraft paths - // we want to load this one instead of the default one from fgdata/Aircraft - BOOST_FOREACH(SGPath p, globals->get_aircraft_paths()) { - paths.push_back(p.str()); - } - - f = osgDB::findDataFile(model_path, opt.get()); - } + p.append(model_path); + if (p.exists()) { + f = p.str(); + break; + } + } // of AI data paths iteration + } // of search in AI path if (f.empty()) { - f = simgear::SGModelLib::findDataFile(model_path); + f = simgear::SGModelLib::findDataFile(model_path); } if(f.empty()) diff --git a/src/Main/AircraftDirVisitorBase.hxx b/src/Main/AircraftDirVisitorBase.hxx index 1096a788d..78e7c90b8 100644 --- a/src/Main/AircraftDirVisitorBase.hxx +++ b/src/Main/AircraftDirVisitorBase.hxx @@ -47,14 +47,6 @@ protected: string_list::const_iterator it = paths.begin(); for (; it != paths.end(); ++it) { SGPath p(*it); - // additional aircraft-paths are supposed to specify the directory - // containing the 'Aircraft' dir (same structure as fg-root, so cross- - // aircraft resource paths can be resolved correctly). Some users omit - // this, so check for both. - p.append("Aircraft"); - if (!p.exists()) - p = SGPath(*it); - VisitResult vr = visitDir(p, 0); if (vr != VISIT_CONTINUE) { return vr; diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index e21e5b591..d57defc0f 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -406,19 +406,13 @@ void FGGlobals::append_aircraft_path(const std::string& path) SGPath acSubdir(dirPath); acSubdir.append("Aircraft"); - if (!acSubdir.exists()) { - if (dirPath.file() == "Aircraft") { - dirPath = dirPath.dir(); - SG_LOG(SG_GENERAL, SG_WARN, "Specified an aircraft-dir path ending in 'Aircraft':" << path - << ", will instead use parent directory:" << dirPath); - } else { - SG_LOG(SG_GENERAL, SG_ALERT, "Aircraft-dir path '" << path << - "' does not contain an 'Aircraft' subdirectory, cross-aircraft paths will not resolve correctly."); - } + if (acSubdir.exists()) { + SG_LOG(SG_GENERAL, SG_WARN, "Specified an aircraft-dir with an 'Aircraft' subdirectory:" << dirPath + << ", will instead use child directory:" << acSubdir); + dirPath = acSubdir; } std::string abspath = dirPath.realpath(); - unsigned int index = fg_aircraft_dirs.size(); fg_aircraft_dirs.push_back(abspath);