]> git.mxchange.org Git - flightgear.git/commitdiff
package system: de-hardcode default catalog id and url
authorTorsten Dreyer <torsten@ŧ3r.de>
Tue, 17 Feb 2015 11:41:18 +0000 (12:41 +0100)
committerTorsten Dreyer <torsten@ŧ3r.de>
Tue, 17 Feb 2015 11:41:18 +0000 (12:41 +0100)
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

src/Network/HTTPClient.cxx

index de6a3d11f75b48202fd204136097395d998e747e..d765c0a429ca285df9a59be0a10e4f6fdcde9ebb 100644 (file)
@@ -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