Add the lists of fix.dat and nav.dat files to the output of --json-report
- Declare 'datTypeStr' and 'defaultDatFile' as public member variables of NavDataCache ('defaultDatFile' is not *required* for this commit, it just seems to make sense to treat both members the same way/keep them together in the source code). - New keys under "navigation data" in the JSON report: "fix.dat files" and "nav.dat files".
This commit is contained in:
parent
99ebfcd368
commit
8372f086c1
2 changed files with 23 additions and 17 deletions
|
@ -2696,22 +2696,27 @@ void Options::printJSONReport() const
|
|||
cJSON_AddStringToObject(configNode, "autosave file",
|
||||
globals->autosaveFilePath().utf8Str().c_str());
|
||||
|
||||
// Get the ordered list of apt.dat files used by the NavCache
|
||||
// Get the ordered lists of apt.dat, fix.dat and nav.dat files used by the
|
||||
// NavCache
|
||||
NavDataCache* cache = NavDataCache::instance();
|
||||
if (!cache) {
|
||||
cache = NavDataCache::createInstance();
|
||||
}
|
||||
|
||||
// For this method, it doesn't matter if the cache is out-of-date
|
||||
NavDataCache::DatFilesGroupInfo aptDatFilesInfo =
|
||||
cache->getDatFilesInfo(NavDataCache::DATFILETYPE_APT);
|
||||
|
||||
// Write the list to the JSON tree
|
||||
cJSON *navDataNode = cJSON_CreateObject();
|
||||
cJSON_AddItemToObject(rootNode, "navigation data", navDataNode);
|
||||
cJSON *aptDatPathsNode = p->createJSONArrayFromPathList(
|
||||
aptDatFilesInfo.paths);
|
||||
cJSON_AddItemToObject(navDataNode, "apt.dat files", aptDatPathsNode);
|
||||
|
||||
// Write each list to the JSON tree
|
||||
for (const auto& datType: {NavDataCache::DATFILETYPE_APT,
|
||||
NavDataCache::DATFILETYPE_FIX,
|
||||
NavDataCache::DATFILETYPE_NAV}) {
|
||||
// For this method, it doesn't matter if the cache is out-of-date
|
||||
const NavDataCache::DatFilesGroupInfo& datFilesInfo =
|
||||
cache->getDatFilesInfo(datType);
|
||||
cJSON *datPathsNode = p->createJSONArrayFromPathList(datFilesInfo.paths);
|
||||
string key = NavDataCache::datTypeStr[datType] + ".dat files";
|
||||
cJSON_AddItemToObject(navDataNode, key.c_str(), datPathsNode);
|
||||
}
|
||||
|
||||
// Print the JSON tree to the standard output
|
||||
char *report = cJSON_Print(rootNode);
|
||||
|
|
|
@ -84,6 +84,15 @@ public:
|
|||
std::size_t totalSize; // total size of all these files, in bytes
|
||||
};
|
||||
|
||||
// datTypeStr[DATFILETYPE_APT] = std::string("apt"), etc. This gives,
|
||||
// among other things, the subdirectory of $scenery_path/NavData where
|
||||
// each type of dat file is looked for.
|
||||
static const std::string datTypeStr[];
|
||||
// defaultDatFile[DATFILETYPE_APT] = std::string("Airports/apt.dat.gz"),
|
||||
// etc. This tells where to find the historical dat files: those under
|
||||
// $FG_ROOT.
|
||||
static const std::string defaultDatFile[];
|
||||
|
||||
// Update d->datFilesInfo and legacy d->metarDatPath, d->poiDatPath,
|
||||
// etc. by looking into $scenery_path/NavData for each scenery path.
|
||||
void updateListsOfDatFiles();
|
||||
|
@ -328,14 +337,6 @@ private:
|
|||
void commitTransaction();
|
||||
void abortTransaction();
|
||||
|
||||
// datTypeStr[DATFILETYPE_APT] = std::string("apt"), etc. This gives, among
|
||||
// other things, the subdirectory of $scenery_path/NavData where each type
|
||||
// of dat file is looked for.
|
||||
static const std::string datTypeStr[];
|
||||
// defaultDatFile[DATFILETYPE_APT] = std::string("Airports/apt.dat.gz"), etc.
|
||||
// This tells where to find the historical dat files: those under $FG_ROOT.
|
||||
static const std::string defaultDatFile[];
|
||||
|
||||
class NavDataCachePrivate;
|
||||
std::unique_ptr<NavDataCachePrivate> d;
|
||||
|
||||
|
|
Loading…
Reference in a new issue