Adjust fg-aircraft handling back to original style.
- startup code will warn and fix the alternate style - man page now documents the option
This commit is contained in:
parent
695a9be75d
commit
80cc2ff8c3
4 changed files with 17 additions and 42 deletions
|
@ -40,8 +40,8 @@ Specify aerodynamics model to load.
|
||||||
Specify aircraft to load.
|
Specify aircraft to load.
|
||||||
.TP
|
.TP
|
||||||
.BI "--aircraft-dir=" "path"
|
.BI "--aircraft-dir=" "path"
|
||||||
Specify the aircraft model directory relative to the path of the
|
Specify the exact directory to use for the aircraft (normally not required,
|
||||||
executable. This is used for UIUC aircraft only.
|
but may be useful for testing).
|
||||||
.TP
|
.TP
|
||||||
.BI "--airport=" "id"
|
.BI "--airport=" "id"
|
||||||
Specify starting postion by 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,
|
Specify the flight dynamics model to use. Name may be one of jsb, larcsim,
|
||||||
yasim, magic, balloon, ada, external, or null.
|
yasim, magic, balloon, ada, external, or null.
|
||||||
.TP
|
.TP
|
||||||
|
.BI "--fg-aircraft=" "path"
|
||||||
|
Specify an additional path to search for aircraft directories. (can be repeated)
|
||||||
|
.TP
|
||||||
.BI "--fg-root=" "path"
|
.BI "--fg-root=" "path"
|
||||||
Specify the root path for data files.
|
Specify the root path for data files.
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -346,28 +346,14 @@ bool FGAIBase::init(bool search_in_AI_path)
|
||||||
string f;
|
string f;
|
||||||
if(search_in_AI_path)
|
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<osgDB::ReaderWriter::Options>
|
|
||||||
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")) {
|
BOOST_FOREACH(SGPath p, globals->get_data_paths("AI")) {
|
||||||
paths.push_back(p.str());
|
p.append(model_path);
|
||||||
}
|
if (p.exists()) {
|
||||||
|
f = p.str();
|
||||||
// search models in --fg-aircraft paths;
|
break;
|
||||||
// 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());
|
|
||||||
}
|
}
|
||||||
|
} // of AI data paths iteration
|
||||||
|
} // of search in AI path
|
||||||
|
|
||||||
if (f.empty()) {
|
if (f.empty()) {
|
||||||
f = simgear::SGModelLib::findDataFile(model_path);
|
f = simgear::SGModelLib::findDataFile(model_path);
|
||||||
|
|
|
@ -47,14 +47,6 @@ protected:
|
||||||
string_list::const_iterator it = paths.begin();
|
string_list::const_iterator it = paths.begin();
|
||||||
for (; it != paths.end(); ++it) {
|
for (; it != paths.end(); ++it) {
|
||||||
SGPath p(*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);
|
VisitResult vr = visitDir(p, 0);
|
||||||
if (vr != VISIT_CONTINUE) {
|
if (vr != VISIT_CONTINUE) {
|
||||||
return vr;
|
return vr;
|
||||||
|
|
|
@ -406,19 +406,13 @@ void FGGlobals::append_aircraft_path(const std::string& path)
|
||||||
|
|
||||||
SGPath acSubdir(dirPath);
|
SGPath acSubdir(dirPath);
|
||||||
acSubdir.append("Aircraft");
|
acSubdir.append("Aircraft");
|
||||||
if (!acSubdir.exists()) {
|
if (acSubdir.exists()) {
|
||||||
if (dirPath.file() == "Aircraft") {
|
SG_LOG(SG_GENERAL, SG_WARN, "Specified an aircraft-dir with an 'Aircraft' subdirectory:" << dirPath
|
||||||
dirPath = dirPath.dir();
|
<< ", will instead use child directory:" << acSubdir);
|
||||||
SG_LOG(SG_GENERAL, SG_WARN, "Specified an aircraft-dir path ending in 'Aircraft':" << path
|
dirPath = acSubdir;
|
||||||
<< ", 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.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string abspath = dirPath.realpath();
|
std::string abspath = dirPath.realpath();
|
||||||
|
|
||||||
unsigned int index = fg_aircraft_dirs.size();
|
unsigned int index = fg_aircraft_dirs.size();
|
||||||
fg_aircraft_dirs.push_back(abspath);
|
fg_aircraft_dirs.push_back(abspath);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue