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.
|
||||
.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
|
||||
|
|
|
@ -346,28 +346,14 @@ 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<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")) {
|
||||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue