package system: de-hardcode default catalog id and url
make default catalog id and url configurable through properties on startup. Provide defaults to preserve current functionality. /sim/package-system/default-catalog/id /sim/package-system/default-catalog/url
This commit is contained in:
parent
828f14c4f7
commit
6ecbca9e01
1 changed files with 8 additions and 5 deletions
|
@ -139,14 +139,17 @@ void FGHTTPClient::init()
|
|||
packageRoot->setHTTPClient(_http.get());
|
||||
|
||||
packageRoot->setDelegate(new FGDelegate);
|
||||
|
||||
|
||||
const char * defaultCatalogId = fgGetString("/sim/package-system/default-catalog/id", "org.flightgear.default" );
|
||||
const char * defaultCatalogUrl = fgGetString("/sim/package-system/default-catalog/url",
|
||||
"http://fgfs.goneabitbursar.com/pkg/" FLIGHTGEAR_VERSION "/default-catalog.xml");
|
||||
// setup default catalog if not present
|
||||
pkg::Catalog* defaultCatalog = packageRoot->getCatalogById("org.flightgear.default");
|
||||
pkg::Catalog* defaultCatalog = packageRoot->getCatalogById( defaultCatalogId );
|
||||
if (!defaultCatalog) {
|
||||
// always show this message
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "default catalog not found, installing...");
|
||||
pkg::Catalog::createFromUrl(packageRoot,
|
||||
"http://fgfs.goneabitbursar.com/pkg/" FLIGHTGEAR_VERSION "/default-catalog.xml");
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "default catalog not found, installing '"
|
||||
<< defaultCatalogId << "' from '" << defaultCatalogUrl << "'.");
|
||||
pkg::Catalog::createFromUrl(packageRoot,defaultCatalogUrl);
|
||||
}
|
||||
|
||||
// start a refresh now
|
||||
|
|
Loading…
Add table
Reference in a new issue