Detect early that an add-on's _info.cfg is missing...

...instead of directly trying to open a stream with it (which triggers
spurious error messages).
This commit is contained in:
Ignacio R. Morelle 2009-03-08 00:35:27 +00:00
parent 7b396dc1bb
commit ace25825d5

View File

@ -1223,20 +1223,23 @@ void refresh_addon_version_info_cache()
config cfg;
std::string const& addon = addons[i];
scoped_istream stream = istream_file(info_file);
read(cfg, *stream);
config const* const info_cfg = cfg.child("info");
if(info_cfg == NULL) {
++i;
continue;
}
std::string const& version = (*info_cfg)["version"];
LOG_CFG << "caching add-on version info: " << addon << " [" << version << "]\n";
version_info_cache.insert(std::make_pair(addon, version_info(version)));
++i;
if(file_exists(info_file)) {
scoped_istream stream = istream_file(info_file);
read(cfg, *stream);
config const* const info_cfg = cfg.child("info");
if(info_cfg == NULL) {
continue;
}
std::string const& version = (*info_cfg)["version"];
LOG_CFG << "caching add-on version info: " << addon << " [" << version << "]\n";
version_info_cache.insert(std::make_pair(addon, version_info(version)));
}
else {
WRN_CFG << "add-on '" << addon << "' has no _info.cfg; cannot read version info\n";
}
}
}