Commit 7227973e2fc493f82e1477ba82e3e8aa956b23ef
- Diff rendering mode:
- inline
- side by side
src/Main/globals.cxx
(19 / 4)
|   | |||
| 72 | 72 | return SGPath(); // not an Aircraft path | |
| 73 | 73 | } | |
| 74 | 74 | ||
| 75 | // test against the aircraft-dir property | ||
| 75 | 76 | const char* aircraftDir = fgGetString("/sim/aircraft-dir"); | |
| 76 | 77 | string_list aircraftDirPieces(sgPathBranchSplit(aircraftDir)); | |
| 77 | 78 | if (aircraftDirPieces.empty() || (aircraftDirPieces.back() != pieces[1])) { | |
| … | … | ||
| 84 | 84 | r.append(pieces[i]); | |
| 85 | 85 | } | |
| 86 | 86 | ||
| 87 | return r.exists() ? r : SGPath(); | ||
| 87 | if (r.exists()) { | ||
| 88 | SG_LOG(SG_IO, SG_INFO, "found path:" << aResource << " via /sim/aircraft-dir: " << r.str()); | ||
| 89 | return r; | ||
| 90 | } | ||
| 91 | |||
| 92 | // try each aircaft dir in turn | ||
| 93 | std::string res(aResource, 9); // resource path with 'Aircraft/' removed | ||
| 94 | const string_list& dirs(globals->get_aircraft_paths()); | ||
| 95 | string_list::const_iterator it = dirs.begin(); | ||
| 96 | for (; it != dirs.end(); ++it) { | ||
| 97 | SGPath p(*it, res); | ||
| 98 | if (p.exists()) { | ||
| 99 | SG_LOG(SG_IO, SG_INFO, "found path:" << aResource << " in aircraft dir: " << r.str()); | ||
| 100 | return p; | ||
| 101 | } | ||
| 102 | } // of aircraft path iteration | ||
| 103 | |||
| 104 | return SGPath(); // not found | ||
| 88 | 105 | } | |
| 89 | 106 | }; | |
| 90 | 107 | ||
| … | … | ||
| 293 | 293 | ||
| 294 | 294 | unsigned int index = fg_aircraft_dirs.size(); | |
| 295 | 295 | fg_aircraft_dirs.push_back(path); | |
| 296 | |||
| 297 | simgear::ResourceManager::instance()->addBasePath(path, | ||
| 298 | simgear::ResourceManager::PRIORITY_NORMAL); | ||
| 299 | 296 | ||
| 300 | 297 | // make aircraft dirs available to Nasal | |
| 301 | 298 | SGPropertyNode* sim = fgGetNode("/sim", true); |

