NavDataCache: don’t duplicate FG_ROOT/Scenery path
Check if the path is in the list, before adding it again.
This commit is contained in:
parent
397aad1d1d
commit
fc037de312
1 changed files with 14 additions and 1 deletions
|
@ -1048,7 +1048,20 @@ void NavDataCache::NavDataCachePrivate::findDatFiles(
|
|||
result.datFileType = datFileType;
|
||||
result.totalSize = 0;
|
||||
|
||||
for (const auto& path: globals->get_fg_scenery()) {
|
||||
// we don't always add FG_ROOT/Scenery to the path list. But if it exists,
|
||||
// we want to pick up NavData files from it, since we have shipped
|
||||
// scenery (for BIKF) which uses newer data than the default files
|
||||
// in Airports/
|
||||
auto paths = globals->get_fg_scenery();
|
||||
const auto fgrootScenery = globals->get_fg_root() / "Scenery";
|
||||
if (fgrootScenery.exists()) {
|
||||
auto it = std::find(paths.begin(), paths.end(), fgrootScenery);
|
||||
if (it == paths.end()) {
|
||||
paths.push_back(fgrootScenery);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& path: paths) {
|
||||
if (! path.isDir()) {
|
||||
SG_LOG(SG_NAVCACHE, SG_WARN, path <<
|
||||
": given as a scenery path, but is not a directory");
|
||||
|
|
Loading…
Add table
Reference in a new issue