]> git.mxchange.org Git - flightgear.git/commitdiff
Automate TerraSync integration with the scenery / dir creation. Now can be used with...
authorJames Turner <zakalawe@mac.com>
Sun, 16 Oct 2011 20:46:27 +0000 (21:46 +0100)
committerJames Turner <zakalawe@mac.com>
Sun, 16 Oct 2011 20:46:27 +0000 (21:46 +0100)
src/Main/options.cxx

index d6ab0b7dffa08d7f58f2f397212c6e37b5123325..e63fac0092cfdfb3ce894f8afa36a01cf643cace 100644 (file)
@@ -1953,9 +1953,33 @@ void Options::processOptions()
   if (envp) {
     globals->append_fg_scenery(envp);
   }
+    
+// terrasync directory fixup
+  if (fgGetBool("/sim/terrasync/enabled")) {
+    string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
+    if (terrasyncDir.empty()) {
+      SGPath p(fgGetString("/sim/fg-home"));
+      p.append("TerraSync");
+      if (!p.exists()) {
+        simgear::Dir dd(p);
+        dd.create(0700);
+      }
+      
+      terrasyncDir = p.str();
+      SG_LOG(SG_GENERAL, SG_INFO,
+             "Using default TerraSync dir: " << terrasyncDir);
+      fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
+    }
+    
+    const string_list& scenery_paths(globals->get_fg_scenery());
+    if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
+      // terrasync dir is not in the scenery paths, add it
+      globals->append_fg_scenery(terrasyncDir);
+    }
+  }
   
   if (globals->get_fg_scenery().empty()) {
-  // no scenery paths set *at all*, use the data in FG_ROOT
+    // no scenery paths set *at all*, use the data in FG_ROOT
     SGPath root(globals->get_fg_root());
     root.append("Scenery");
     globals->append_fg_scenery(root.str());