Fix bug #187: check if path cache matches fg-aircraft dirs
Check if any fg-aircraft dir changed - sequence also matters.
This commit is contained in:
parent
27a7b98284
commit
79094e8c36
1 changed files with 22 additions and 1 deletions
|
@ -601,6 +601,9 @@ public:
|
||||||
SGPropertyNode *n = _cache->getNode("fg-root", true);
|
SGPropertyNode *n = _cache->getNode("fg-root", true);
|
||||||
n->setStringValue(globals->get_fg_root().c_str());
|
n->setStringValue(globals->get_fg_root().c_str());
|
||||||
n->setAttribute(SGPropertyNode::USERARCHIVE, true);
|
n->setAttribute(SGPropertyNode::USERARCHIVE, true);
|
||||||
|
n = _cache->getNode("fg-aircraft", true);
|
||||||
|
n->setStringValue(getAircraftPaths().c_str());
|
||||||
|
n->setAttribute(SGPropertyNode::USERARCHIVE, true);
|
||||||
_cache->removeChildren("aircraft");
|
_cache->removeChildren("aircraft");
|
||||||
|
|
||||||
fgFindAircraft(this, &FindAndCacheAircraft::checkAircraft);
|
fgFindAircraft(this, &FindAndCacheAircraft::checkAircraft);
|
||||||
|
@ -629,12 +632,30 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
SGPath getAircraftPaths() {
|
||||||
|
string_list pathList = globals->get_aircraft_paths();
|
||||||
|
SGPath aircraftPaths;
|
||||||
|
string_list::const_iterator it = pathList.begin();
|
||||||
|
if (it != pathList.end()) {
|
||||||
|
aircraftPaths.set(*it);
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
for (; it != pathList.end(); ++it) {
|
||||||
|
aircraftPaths.add(*it);
|
||||||
|
}
|
||||||
|
return aircraftPaths;
|
||||||
|
}
|
||||||
|
|
||||||
bool checkCache()
|
bool checkCache()
|
||||||
{
|
{
|
||||||
if (globals->get_fg_root() != _cache->getStringValue("fg-root", "")) {
|
if (globals->get_fg_root() != _cache->getStringValue("fg-root", "")) {
|
||||||
return false; // cache mismatch
|
return false; // cache mismatch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getAircraftPaths().str() != _cache->getStringValue("fg-aircraft", "")) {
|
||||||
|
return false; // cache mismatch
|
||||||
|
}
|
||||||
|
|
||||||
vector<SGPropertyNode_ptr> cache = _cache->getChildren("aircraft");
|
vector<SGPropertyNode_ptr> cache = _cache->getChildren("aircraft");
|
||||||
for (unsigned int i = 0; i < cache.size(); i++) {
|
for (unsigned int i = 0; i < cache.size(); i++) {
|
||||||
const char *name = cache[i]->getStringValue("file", "");
|
const char *name = cache[i]->getStringValue("file", "");
|
||||||
|
|
Loading…
Reference in a new issue