+
+ // check for duplicates
+ string_list::const_iterator ex = std::find(fg_scenery.begin(), fg_scenery.end(), abspath.str());
+ if (ex != fg_scenery.end()) {
+ SG_LOG(SG_GENERAL, SG_INFO, "skipping duplicate add of scenery path:" << abspath.str());
+ continue;
+ }
+
+ simgear::Dir dir(abspath);
+ SGPath terrainDir(dir.file("Terrain"));
+ SGPath objectsDir(dir.file("Objects"));
+
+ // this code used to add *either* the base dir, OR add the
+ // Terrain and Objects subdirs, but the conditional logic was commented
+ // out, such that all three dirs are added. Unfortunately there's
+ // no information as to why the change was made.
+ fg_scenery.push_back(abspath.str());
+
+ if (terrainDir.exists()) {
+ fg_scenery.push_back(terrainDir.str());
+ }
+
+ if (objectsDir.exists()) {
+ fg_scenery.push_back(objectsDir.str());
+ }
+
+ // insert a marker for FGTileEntry::load(), so that
+ // FG_SCENERY=A:B becomes list ["A/Terrain", "A/Objects", "",
+ // "B/Terrain", "B/Objects", ""]
+ fg_scenery.push_back("");
+
+ // make scenery dirs available to Nasal
+ SGPropertyNode* n = sim->getChild("fg-scenery", propIndex++, true);
+ n->setStringValue(abspath.str());
+ n->setAttribute(SGPropertyNode::WRITE, false);
+ } // of path list iteration
+}
+
+void FGGlobals::append_aircraft_path(const std::string& path)
+{
+ SGPath dirPath(path);
+ if (!dirPath.exists()) {
+ SG_LOG(SG_GENERAL, SG_WARN, "aircraft path not found:" << path);
+ return;
+ }
+ std::string abspath = dirPath.realpath();
+
+ unsigned int index = fg_aircraft_dirs.size();
+ fg_aircraft_dirs.push_back(abspath);
+
+// make aircraft dirs available to Nasal
+ SGPropertyNode* sim = fgGetNode("/sim", true);
+ sim->removeChild("fg-aircraft", index, false);
+ SGPropertyNode* n = sim->getChild("fg-aircraft", index, true);
+ n->setStringValue(abspath);
+ n->setAttribute(SGPropertyNode::WRITE, false);
+}
+
+void FGGlobals::append_aircraft_paths(const std::string& path)
+{
+ string_list paths = sgPathSplit(path);
+ for (unsigned int p = 0; p<paths.size(); ++p) {
+ append_aircraft_path(paths[p]);
+ }